{"record":{"id":"402327a4c6cc984a","repo":"tirth8205/code-review-graph","slug":"expected-colon-after-json-object-key","errorCode":null,"errorMessage":"expected colon after JSON object key","messagePattern":"expected colon after JSON object key","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"code_review_graph/uninstall.py","lineNumber":282,"sourceCode":"            continue\n        index += 1\n    raise ValueError(\"unterminated JSON container\")\n\n\ndef _object_members(tokens: Sequence[_Token], index: int) -> list[_Member]:\n    if index >= len(tokens) or tokens[index].kind != \"{\":\n        raise ValueError(\"expected JSON object\")\n    members: list[_Member] = []\n    cursor = index + 1\n    while cursor < len(tokens) and tokens[cursor].kind != \"}\":\n        if tokens[cursor].kind == \",\":  # trailing comma\n            cursor += 1\n            continue\n        key_token = tokens[cursor]\n        if key_token.kind != \"string\" or not isinstance(key_token.value, str):\n            raise ValueError(\"expected JSON object key\")\n        if cursor + 1 >= len(tokens) or tokens[cursor + 1].kind != \":\":\n            raise ValueError(\"expected colon after JSON object key\")\n        value_index = cursor + 2\n        value_end = _skip_value(tokens, value_index)\n        comma_index = value_end if (\n            value_end < len(tokens) and tokens[value_end].kind == \",\"\n        ) else None\n        members.append(\n            _Member(key_token.value, cursor, value_index, value_end, comma_index)\n        )\n        cursor = value_end + 1 if comma_index is not None else value_end\n    return members\n\n\ndef _array_elements(tokens: Sequence[_Token], index: int) -> list[_Element]:\n    if index >= len(tokens) or tokens[index].kind != \"[\":\n        raise ValueError(\"expected JSON array\")\n    elements: list[_Element] = []\n    cursor = index + 1\n    while cursor < len(tokens) and tokens[cursor].kind != \"]\":","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/uninstall.py#L264-L300","documentation":"Raised by _object_members when a string key token is not followed by a ':' token. The parser found a key-like string but no colon separating it from its value, so the object member is structurally incomplete. Like the other _object_members errors, it signals malformed JSONC at the edit target rather than a bad API argument.","triggerScenarios":"An object like {\"key\"} or {\"key\" , \"other\": 1} — a string followed by anything other than ':'. Also triggered when the token stream ends right after the key (cursor + 1 >= len(tokens)), e.g. a file truncated mid-object.","commonSituations":"Truncated config file from a crashed earlier write; user deleted a colon while hand-editing; merge conflict resolution left broken syntax; JSON5/JS-style shorthand value written by mistake.","solutions":["Fix the missing/truncated colon so every key is '\"key\": value'","If the file was truncated, restore it from backup/VCS before retrying the uninstall","Validate with json.loads on comment-stripped content before running removal","Wrap the removal call in try/except ValueError and leave the file unmodified on failure"],"exampleFix":"// before\n{ \"mcpServers\" }  // -> expected colon after JSON object key\n\n// after\n{ \"mcpServers\": {} }","handlingStrategy":"validation","validationCode":"import json, re\ndef object_members_wellformed(text: str) -> bool:\n    try:\n        json.loads(re.sub(r\"//[^\\n]*|/\\*.*?\\*/\", \"\", text, flags=re.S))\n        return True\n    except ValueError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    _remove_jsonc_paths(text, paths)\nexcept ValueError as e:\n    if 'colon' in str(e):\n        restore_from_backup()","preventionTips":["Ensure no truncated writes (write configs atomically via temp file + rename)","Never leave merge-conflict markers in JSON configs","Check file size > 0 and structure before automated edits"],"tags":["json","jsonc","syntax","colon","truncated-file"],"backgroundTag":"json-parse-error","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}