{"record":{"id":"4f6c25e6fc3076cd","repo":"affaan-m/ECC","slug":"config-must-be-a-json-object","errorCode":null,"errorMessage":"config must be a JSON object","messagePattern":"config must be a JSON object","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/workflow_graphs.py","lineNumber":133,"sourceCode":"    graph = json.loads((WORKFLOWS / f'taste-{kind}.json').read_text())\n    validate_graph(graph)\n    return graph\n\n\ndef 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:","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/workflow_graphs.py#L115-L151","documentation":"main() parses the config file (or a loaded application request) and requires the top-level JSON value to be a dict. A JSON array, string, number, or null at the top level raises ValueError('config must be a JSON object').","triggerScenarios":"The file at args.config contains e.g. a bare JSON array [ ... ] or a quoted string instead of a { ... } object; load_application_request returns a non-dict value.","commonSituations":"Exporting a list of settings instead of a settings object; saving an empty file or just a scalar; pointing --config at the wrong file (e.g. a workflow JSON that is an array).","solutions":["Wrap the config contents in a top-level JSON object with the expected keys (e.g. integration, inputs)","Validate the file with python -m json.tool and confirm the outermost value is an object","Point --config at the correct config file for the chosen --kind","If using apply-bundle, ensure load_application_request produced a mapping (check the request file format)"],"exampleFix":"// before (config.json)\n[{\"integration\": \"...\"}]\n// after\n{\"integration\": \"...\"}","handlingStrategy":"validation","validationCode":"import json\nconfig = json.loads(path.read_text())\nif not isinstance(config, dict):\n    raise SystemExit(f'{path}: top-level JSON must be an object')","typeGuard":"def is_json_object(v):\n    return isinstance(v, dict)","tryCatchPattern":"try:\n    config = load_and_check(path)\nexcept ValueError as e:\n    if 'config must be a JSON object' in str(e):\n        print(f'Fix {path}: wrap contents in a top-level {{...}} object')","preventionTips":["Always save configs as objects with named keys, never bare arrays/scalars","Validate config files with json.tool before submitting them to the CLI","Use a JSON schema (type: object) in your editor for config files"],"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"}