{"record":{"id":"cb5a42b4151d2bc1","repo":"iflytek/astron-agent","slug":"invalid-json-format-for-params-e","errorCode":null,"errorMessage":"Invalid JSON format for 'params': {e}","messagePattern":"Invalid JSON format for 'params': (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"core/plugin/rpa/api/v1/execution.py","lineNumber":56,"sourceCode":"        acctss_token = (\n            Authorization[7:] if Authorization.startswith(\"Bearer \") else Authorization\n        )\n        return EventSourceResponse(\n            task_monitoring(\n                sid=request.sid,\n                access_token=acctss_token,\n                project_id=request.project_id,\n                version=request.version,\n                phone_number=request.phone_number,\n                exec_position=request.exec_position,\n                params=request.params,\n            ),\n            headers=headers,\n            ping=ping_interval,\n        )\n    except json.JSONDecodeError as e:\n        raise HTTPException(\n            status_code=400, detail=f\"Invalid JSON format for 'params':\" f\" {e}\"\n        ) from e\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e)) from e\n","sourceCodeStart":38,"sourceCodeEnd":60,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/rpa/api/v1/execution.py#L38-L60","documentation":"exec_fun validates that the 'params' field of the RPA execution request is valid JSON. If json.loads on the params fails, it converts the JSONDecodeError into an HTTP 400 with detail 'Invalid JSON format for 'params': <reason>'. This is a client-input error surfaced through FastAPI's HTTPException.","triggerScenarios":"POSTing to the RPA execution endpoint with a 'params' value that is not valid JSON — unquoted strings, single quotes, trailing commas, embedded newlines in strings, or an already-encoded JSON string double-encoded incorrectly.","commonSituations":"Frontend sending stringified params with quoting mistakes; users pasting params with single quotes; params built via naive string concatenation instead of json.dumps; testing tools (curl/Postman) sending raw text in the params field.","solutions":["Fix the client to send syntactically valid JSON in 'params' — validate with json.loads before sending","Build params programmatically with json.dumps rather than hand-formatted strings","Check the HTTP response 400 detail; it names the exact character/line where parsing failed"],"exampleFix":"// before (client)\nparams = \"{'key': 'value'}\"  // single quotes -> invalid JSON\n// after\nimport json\nparams = json.dumps({\"key\": \"value\"})  // '{\"key\": \"value\"}'","handlingStrategy":"validation","validationCode":"import json\ndef valid_params(params: str) -> bool:\n    try:\n        json.loads(params)\n        return True\n    except json.JSONDecodeError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    resp = requests.post(url, json={\"params\": params_json_str, ...})\nexcept requests.HTTPError as e:\n    if e.response.status_code == 400:\n        # fix params JSON on the client side\n        ...","preventionTips":["Serialize params with json.dumps instead of hand-built strings","Validate params JSON client-side before posting","Send JSON in double quotes; avoid single quotes and trailing commas"],"tags":["fastapi","json","http-400","input-validation"],"backgroundTag":"json-parse-error","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}