{"record":{"id":"ca9b6fc677653fcb","repo":"affaan-m/ECC","slug":"local-only-must-be-an-exact-boolean-workflow-graphs","errorCode":null,"errorMessage":"local_only must be an exact boolean","messagePattern":"local_only must be an exact boolean","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/workflow_graphs.py","lineNumber":138,"sourceCode":"def main():\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument('--kind', choices=('apply', 'apply-bundle', 'distill'), required=True)\n    parser.add_argument('--config', type=Path, required=True)\n    parser.add_argument('--out', type=Path, required=True)\n    args = parser.parse_args()\n    try:\n        if args.kind == 'apply-bundle':\n            from tasteforge.integration import build_application_bundle, load_application_request\n            config = load_application_request(args.config)\n        else:\n            config = json.loads(args.config.read_text())\n        if not isinstance(config, dict):\n            raise ValueError('config must be a JSON object')\n        local_only = False\n        if args.kind == 'apply-bundle':\n            local_only = config.get('local_only', False)\n            if type(local_only) is not bool:\n                raise ValueError('local_only must be an exact boolean')\n        if local_only:\n            if set(config) != {'local_only', 'integration'}:\n                raise ValueError('local-only request permits only local_only and integration fields')\n            payload = build_application_bundle(config['integration'], None, local_only=True)\n        else:\n            load_graph('apply' if args.kind == 'apply-bundle' else args.kind)\n            compile_input = compile_application_input if args.kind != 'distill' else prepare_distillation_input\n            payload = compile_input(config)\n            if args.kind == 'apply-bundle':\n                payload = build_application_bundle(config.get('integration'), payload)\n        with args.out.open('x') as output:\n            output.write(json.dumps(payload, indent=2) + '\\n')\n    except (OSError, ValueError, KeyError) as error:\n        parser.exit(2, f'Offline compilation failed: {error}\\n')\n\n\nif __name__ == '__main__':\n    main()","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/workflow_graphs.py#L120-L156","documentation":"For apply-bundle configs, the optional local_only field must be a real JSON boolean (type is bool, so 1/0 or \"true\" strings are rejected). main() raises ValueError('local_only must be an exact boolean') otherwise.","triggerScenarios":"A config file contains \"local_only\": \"true\", \"local_only\": 1, or \"local_only\": null — any non-bool value triggers the check.","commonSituations":"Hand-writing the config and quoting the boolean; generating config from a template or language where booleans serialize as 0/1; YAML-ish habits leaking into JSON.","solutions":["Change the value to a bare JSON true or false (no quotes, no 1/0)","Remove the local_only key entirely if network execution is desired (defaults to false)","Regenerate the config with a JSON serializer (json.dumps) instead of string templating","Validate the config by running json.loads locally and asserting isinstance(v, bool) before invoking the CLI"],"exampleFix":"// before\n{\"local_only\": \"true\", \"integration\": {...}}\n// after\n{\"local_only\": true, \"integration\": {...}}","handlingStrategy":"type-guard","validationCode":"v = config.get('local_only', False)\nif type(v) is not bool:\n    raise SystemExit('local_only must be JSON true/false, not a string or number')","typeGuard":"def is_exact_bool(v):\n    return type(v) is bool","tryCatchPattern":"try:\n    run_cli(args)\nexcept ValueError as e:\n    if 'local_only must be an exact boolean' in str(e):\n        cfg['local_only'] = cfg['local_only'] in (True, 'true', 1)\n        # rewrite config and retry once","preventionTips":["Never quote booleans in JSON configs","Generate configs with json.dumps so types stay native","Add a pre-commit check asserting type(v) is bool for known boolean fields"],"tags":["json","configuration","type-check"],"backgroundTag":"config-type-mismatch","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}