{"record":{"id":"9fedc9d70aa75291","repo":"Hmbown/CodeWhale","slug":"codewhale-stream-json-schema-did-not-match-v0-9-1","errorCode":null,"errorMessage":"Codewhale stream-json schema did not match v0.9.1","messagePattern":"Codewhale stream-json schema did not match v0\\.9\\.1","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"integrations/verifiers-codewhale/codewhale_harness/harness.py","lineNumber":365,"sourceCode":"    terminal: dict[str, Any] | None = None\n    ordered_types: list[str] = []\n    for line_number, line in enumerate(stdout.splitlines(), start=1):\n        if not line.strip():\n            continue\n        try:\n            event = json.loads(line)\n        except json.JSONDecodeError as error:\n            raise RuntimeError(\n                f\"Codewhale stream-json line {line_number} was not valid JSON\"\n            ) from error\n        if not isinstance(event, dict):\n            raise RuntimeError(\n                f\"Codewhale stream-json line {line_number} was not an object\"\n            )\n        if event.get(\"schema\") != STREAM_SCHEMA or event.get(\n            \"schema_version\"\n        ) != STREAM_SCHEMA_VERSION:\n            raise RuntimeError(\"Codewhale stream-json schema did not match v0.9.1\")\n        event_type = event.get(\"type\")\n        if event_type not in _EVENT_TYPES:\n            raise RuntimeError(\"Codewhale stream-json contained an unknown event type\")\n        counts[event_type] += 1\n        ordered_types.append(event_type)\n        if event_type == \"metadata\":\n            if terminal is not None:\n                raise RuntimeError(\"Codewhale emitted more than one terminal metadata receipt\")\n            meta = event.get(\"meta\")\n            if not isinstance(meta, dict) or meta.get(\"receipt_kind\") != \"terminal\":\n                raise RuntimeError(\"Codewhale metadata event was not a terminal receipt\")\n            terminal = _bounded_terminal(meta)\n\n    if terminal is None:\n        raise RuntimeError(\"Codewhale stream-json omitted terminal metadata\")\n    if counts[\"done\"] != 1 or not ordered_types or ordered_types[-1] != \"done\":\n        raise RuntimeError(\"Codewhale stream-json did not end with exactly one done event\")\n    if ordered_types[-2:-1] != [\"metadata\"]:","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/verifiers-codewhale/codewhale_harness/harness.py#L347-L383","documentation":"Every stream-json event must declare schema 'codewhale.exec-stream' and schema_version 1 (the v0.9.1 contract). This RuntimeError means an event object had a missing or different schema/schema_version. The harness throws it to refuse output from incompatible Codewhale versions, since field semantics may have changed.","triggerScenarios":"_parse_stream_receipt read an event dict where event['schema'] != STREAM_SCHEMA or event['schema_version'] != STREAM_SCHEMA_VERSION — i.e. the binary emits a different stream dialect than the pinned 0.9.1 one.","commonSituations":"binary_path pointing at a newer/older Codewhale than the pinned 0.9.1; a fork that renamed the schema; a relay that forwards events but drops or rewrites envelope fields.","solutions":["Run the binary with --version and confirm it is exactly the version CodewhaleHarnessConfig.version pins","Remove/align binary_path overrides so the installed 0.9.1 release is used","Check whether the stream schema was bumped upstream and bump STREAM_SCHEMA_VERSION/harness together","Inspect the offending event to see which envelope field is missing or renamed","If a proxy rewrites events, forward the schema/schema_version fields verbatim"],"exampleFix":"# before\nconfig = CodewhaleHarnessConfig(version=\"0.9.1\", binary_path=\"/usr/local/bin/codewhale-new\")\n# after\nconfig = CodewhaleHarnessConfig(version=\"0.9.1\")  # let setup install pinned 0.9.1","handlingStrategy":"validation","validationCode":"def envelope_ok(event: dict) -> bool:\n    return (event.get(\"schema\") == \"codewhale.exec-stream\"\n            and event.get(\"schema_version\") == 1)","typeGuard":"def has_valid_schema(event: object) -> bool:\n    return (isinstance(event, dict)\n            and event.get(\"schema\") == \"codewhale.exec-stream\"\n            and event.get(\"schema_version\") == 1)","tryCatchPattern":"try:\n    result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)\nexcept RuntimeError as e:\n    if \"schema did not match\" in str(e):\n        logger.error(\"binary/schema version mismatch; re-pin Codewhale 0.9.1\")\n    raise","preventionTips":["Keep config.version and the installed binary in lockstep (let setup() install, avoid stray binary_path)","Run the binary's --version as a pre-flight check in your runner","Coordinate any upstream schema bump with STREAM_SCHEMA/STREAM_SCHEMA_VERSION changes","Proxies/relays must forward schema fields verbatim"],"tags":["schema","versioning","compatibility"],"backgroundTag":"schema-validation-failed","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}