{"record":{"id":"1e05474e9d230351","repo":"FoundationAgents/MetaGPT","slug":"expecting-delimiter","errorCode":null,"errorMessage":"Expecting ':' delimiter","messagePattern":"Expecting ':' delimiter","errorType":"exception","errorClass":"JSONDecodeError","httpStatus":null,"severity":"error","filePath":"metagpt/utils/custom_decoder.py","lineNumber":152,"sourceCode":"                pairs = object_hook(pairs)\n            return pairs, end + 1\n        elif nextchar != '\"':\n            raise JSONDecodeError(\"Expecting property name enclosed in double quotes\", s, end)\n    end += 1\n    while True:\n        if end + 1 < len(s) and s[end] == nextchar and s[end + 1] == nextchar:\n            # Handle the case where the next two characters are the same as nextchar\n            key, end = scanstring(s, end + 2, strict, delimiter=nextchar * 3)\n        else:\n            # Handle the case where the next two characters are not the same as nextchar\n            key, end = scanstring(s, end, strict, delimiter=nextchar)\n        key = memo_get(key, key)\n        # To skip some function call overhead we optimize the fast paths where\n        # the JSON key separator is \": \" or just \":\".\n        if s[end : end + 1] != \":\":\n            end = _w(s, end).end()\n            if s[end : end + 1] != \":\":\n                raise JSONDecodeError(\"Expecting ':' delimiter\", s, end)\n        end += 1\n\n        try:\n            if s[end] in _ws:\n                end += 1\n                if s[end] in _ws:\n                    end = _w(s, end + 1).end()\n        except IndexError:\n            pass\n\n        try:\n            value, end = scan_once(s, end)\n        except StopIteration as err:\n            raise JSONDecodeError(\"Expecting value\", s, err.value) from None\n        pairs_append((key, value))\n        try:\n            nextchar = s[end]\n            if nextchar in _ws:","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/utils/custom_decoder.py#L134-L170","documentation":"Raised by MetaGPT's custom decoder (metagpt/utils/custom_decoder.py) while scanning an object: after a key string is consumed, it expects the next significant character to be ':' (optionally after whitespace). If it isn't — a missing colon between key and value — JSONDecodeError('Expecting \\'\\:\\' delimiter') is raised at that position.","triggerScenarios":"Decoding '{\"a\" 1}' (colon omitted); '{\"a\" = 1}' (equals sign, YAML/JS habit); '{\"a\", \"b\": 1}' (comma where colon belongs); a truncated string like '{\"key\"' where the input ends before the colon.","commonSituations":"LLM writes JS-object or YAML-flavored syntax inside JSON; hand-typed config files with '=' instead of ':'; response truncated by max_tokens right after the key token.","solutions":["Look at the colno in the JSONDecodeError; the character right there should be a colon.","Fix the source text: '{\"a\": 1}', '{\"a\": 1}'.","For '=' style input, convert it (replace '=' with ':' before decoding) or use a YAML parser.","Increase max_tokens / re-request if truncation cut the JSON mid-object."],"exampleFix":"# before\nloads('{\"a\" 1}')  # missing colon\n\n# after\nloads('{\"a\": 1}')","handlingStrategy":"try-catch","validationCode":"import re\n\ndef fix_missing_colons(text: str) -> str:\n    return re.sub(r'(\"(?:[^\"\\\\]|\\\\.)*\")\\s+(?=[\"\\[\\{\\d\\wtfn])', r'\\1:', text)  # heuristic 'key\" value' -> 'key\": value'","typeGuard":null,"tryCatchPattern":"from json import JSONDecodeError\ntry:\n    obj = loads(text)\nexcept JSONDecodeError as e:\n    if e.msg == \"Expecting ':' delimiter\":\n        # inspect text at (e.lineno, e.colno); repair '=' or missing ':' and retry","preventionTips":["Reject JS/YAML-style output ('=', missing colons) from the model with explicit JSON schema examples.","Check truncation: input ending right after a key also produces this error.","Use colno to verify the exact character where the colon was expected."],"tags":["metagpt","json","llm-output","parsing","custom-decoder"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}