{"record":{"id":"459efb10cc325f1b","repo":"usestrix/strix","slug":"extra-system-prompt-context-cannot-override-built","errorCode":null,"errorMessage":"extra_system_prompt_context cannot override built-in scope keys: {sorted(reserved_keys)}","messagePattern":"extra_system_prompt_context cannot override built-in scope keys: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/core/runner.py","lineNumber":73,"sourceCode":"    from agents.result import RunResultBase\n\n    from strix.runtime.status import StatusSink\n\n\nlogger = logging.getLogger(__name__)\n\nStreamEventSink = Callable[[str, Any], None]\n\n\ndef _merge_root_prompt_context(\n    scope_context: dict[str, Any],\n    extra_system_prompt_context: dict[str, Any] | None,\n) -> dict[str, Any]:\n    if not extra_system_prompt_context:\n        return scope_context\n    reserved_keys = scope_context.keys() & extra_system_prompt_context.keys()\n    if reserved_keys:\n        raise ValueError(\n            \"extra_system_prompt_context cannot override built-in scope keys: \"\n            f\"{sorted(reserved_keys)}\",\n        )\n    return {**scope_context, **extra_system_prompt_context}\n\n\ndef _compose_root_instructions_override(\n    root_instructions_override: str | None,\n    *,\n    skills: list[str],\n    scan_mode: str,\n    is_whitebox: bool,\n    interactive: bool,\n    system_prompt_context: dict[str, Any],\n) -> str | None:\n    if root_instructions_override is None:\n        return None\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/core/runner.py#L55-L91","documentation":"Raised by _merge_root_prompt_context (strix/core/runner.py:73) when the caller-supplied extra_system_prompt_context dict contains keys that collide with the built-in scope context keys. The scope context carries authoritative scan facts (target, mode, whitebox flag, etc.), so allowing user extras to overwrite them would silently corrupt the root agent's instructions. It is a plain ValueError raised at scan setup, before any LLM call.","triggerScenarios":"Calling run_strix_scan(..., extra_system_prompt_context={'target': ..., ...}) or configuring extra context keys in settings that overlap with the keys the selected scope already injects (scope_context.keys() & extra.keys() is non-empty).","commonSituations":"Embedding Strix programmatically and passing generic keys like 'target', 'scan_mode', or 'instructions' that the scope also sets; upgrading Strix versions where a scope gained new built-in keys that now collide with previously-working extras.","solutions":["Rename the offending keys in extra_system_prompt_context so they do not shadow built-in scope keys — the error message lists the exact colliding keys (sorted).","If you need to change scan behavior, use the dedicated parameters (target, scan_mode, root_instructions_override) instead of prompt-context keys.","Print/inspect the scope_context keys for your scope version and diff them against your extras before launching."],"exampleFix":"# before\nrun_strix_scan(..., extra_system_prompt_context={\"target\": \"https://x.com\"})\n\n# after\nrun_strix_scan(..., extra_system_prompt_context={\"engagement_notes\": \"focus on auth endpoints\"})","handlingStrategy":"validation","validationCode":"scope_keys = set(scope_context)  # keys the selected scope injects\nextra = {k: v for k, v in (extra_system_prompt_context or {}).items()}\nclash = scope_keys & set(extra)\nassert not clash, f'rename these keys: {sorted(clash)}'","typeGuard":"def is_scope_override_error(exc: BaseException) -> bool:\n    return isinstance(exc, ValueError) and 'cannot override built-in scope keys' in str(exc)","tryCatchPattern":"try:\n    run_strix_scan(..., extra_system_prompt_context=extra)\nexcept ValueError as exc:\n    if 'cannot override built-in scope keys' in str(exc):\n        clash = parse_keys_from_message(str(exc))\n        extra = {k: v for k, v in extra.items() if k not in clash}\n        run_strix_scan(..., extra_system_prompt_context=extra)\n    else:\n        raise","preventionTips":["Namespace your extra keys with a prefix (e.g. 'corp_') to avoid collisions.","Re-run the key diff after upgrading Strix, since scopes gain built-in keys over time."],"tags":["configuration","prompt-context","validation","setup"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}