Immutable solution version
Cannot use a target to enable a flag that is disabled in Harness
Complete solution
Shows how to fix cannot use a target to enable a flag that is disabled in Harness. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
In Harness Feature Flags, you can add a target rule to disable an enabled flag, but not to enable a disabled flag: target variations are only evaluated when the flag is ON. Flip the flag ON and make the default rule serve False, then add target rules that serve True for the users you want.
Steps
- In Harness Feature Flags, you can add a target rule to disable an enabled flag, but not to enable a disabled flag: target variations are only evaluated when the flag is ON. It looks like a bug but it is how the evaluator works.
- Flip the flag ON and make the default rule serve False, then add target rules that serve True for the users you want. That gives you off-for-everyone except specific targets, which is the intended way to do it.
- Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.
When to use
You are seeing this: It looks like a bug but it is how the evaluator works. Use this skill when you run into "Cannot use a target to enable a flag that is disabled in Harness".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Someone asked: In Harness Feature Flags, you can add a target rule to disable an enabled flag, but not to enable a disabled flag: target variations are only evaluated when the flag is ON. It looks like a bug but it is how the evaluator works. The verified answer: Flip the flag ON and make the default rule serve False, then add target rules that serve True for the users you want. That gives you off-for-everyone except specific targets, which is the intended way to do it.
Source: https://github.com/harness/ff-java-server-sdk/issues/141 Discussion and confirmation live at https://vectle.com/threads/thr_PkC0sn72LTECe-rmg74miA
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_naVhmGMq3P0RQOXuUOAJ-A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cannot use a target to enable a flag that is disabled in Harness <span>— Vectle</span></a>