{"record":{"id":"eeb0ba3d18f5a4db","repo":"BoundaryML/baml","slug":"feedback-payload-must-be-a-json-object-like-title","errorCode":null,"errorMessage":"feedback payload must be a JSON object like {\"title\": \"...\"}","messagePattern":"feedback payload must be a JSON object like (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/feedback_command.rs","lineNumber":506,"sourceCode":"    use base64::Engine as _;\n    json!(\n        files\n            .iter()\n            .map(|f| json!({\n                \"name\": f.name,\n                \"mime\": f.mime,\n                \"size_bytes\": f.size_bytes,\n                \"content_base64\": base64::engine::general_purpose::STANDARD\n                    .encode(f.content.as_deref().unwrap_or_default()),\n            }))\n            .collect::<Vec<_>>()\n    )\n}\n\nfn parse_payload_json(raw: &str) -> Result<Value> {\n    let value: Value = serde_json::from_str(raw).context(\"feedback payload is not valid JSON\")?;\n    if !value.is_object() {\n        return Err(anyhow::anyhow!(\n            \"feedback payload must be a JSON object like {{\\\"title\\\": \\\"...\\\"}}\"\n        ));\n    }\n    Ok(value)\n}\n\n// ---------------------------------------------------------------------------\n// Local report store: <BAML_HOME>/feedback.json\n// ---------------------------------------------------------------------------\n\n#[derive(Debug, Deserialize, Serialize)]\nstruct FeedbackStore {\n    /// Whether `baml feedback` sends anything from this machine.\n    #[serde(default = \"default_true\")]\n    enabled: bool,\n    /// Reports from this machine, oldest first.\n    #[serde(default)]\n    reports: Vec<FeedbackRecord>,","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/feedback_command.rs#L488-L524","documentation":"The `baml feedback` CLI command accepts a `--payload` JSON string that is parsed by `parse_payload_json`. This error is thrown when the payload parses as valid JSON but is not a JSON object (e.g. a string, number, array, or boolean). The feedback pipeline requires key/value metadata like {\"title\": \"...\"} to attach to the report.","triggerScenarios":"Running `baml feedback --payload 'some string'`, `--payload '[1,2,3]'`, `--payload '42'`, or any non-object JSON literal. Also triggered by quoting mistakes in the shell that strip the braces.","commonSituations":"Shell quoting mishaps (e.g. double-quoted braces eaten by the shell), pasting a JSON array of fields instead of an object, or passing a bare string title without wrapping it in an object.","solutions":["Pass the payload as a JSON object: --payload '{\"title\": \"My feedback\"}'","Wrap the value in braces if you passed an array or bare string.","Validate the JSON locally first: `echo '<payload>' | jq -e 'type == \"object\"'`.","Use single quotes around the payload on Unix shells so braces and quotes survive."],"exampleFix":"// before\nbaml feedback --payload '\"My title\"'\n// after\nbaml feedback --payload '{\"title\": \"My title\"}'","handlingStrategy":"validation","validationCode":"const payload = JSON.parse(raw);\nif (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {\n  throw new Error('feedback payload must be a JSON object like {\"title\": \"...\"}');\n}","typeGuard":"function isJsonObject(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v);\n}","tryCatchPattern":null,"preventionTips":["Always quote the payload with single quotes in shell so braces survive.","Validate with `jq -e 'type == \"object\"'` before passing to the CLI.","Keep a shell alias/function that wraps the object construction for you."],"tags":["cli","json","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}