BoundaryML/baml · error
feedback payload must be a JSON object like {"title": "..."}
Error message
feedback payload must be a JSON object like {"title": "..."} What it means
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.
Source
Thrown at baml_language/crates/baml_cli/src/feedback_command.rs:506
use base64::Engine as _;
json!(
files
.iter()
.map(|f| json!({
"name": f.name,
"mime": f.mime,
"size_bytes": f.size_bytes,
"content_base64": base64::engine::general_purpose::STANDARD
.encode(f.content.as_deref().unwrap_or_default()),
}))
.collect::<Vec<_>>()
)
}
fn parse_payload_json(raw: &str) -> Result<Value> {
let value: Value = serde_json::from_str(raw).context("feedback payload is not valid JSON")?;
if !value.is_object() {
return Err(anyhow::anyhow!(
"feedback payload must be a JSON object like {{\"title\": \"...\"}}"
));
}
Ok(value)
}
// ---------------------------------------------------------------------------
// Local report store: <BAML_HOME>/feedback.json
// ---------------------------------------------------------------------------
#[derive(Debug, Deserialize, Serialize)]
struct FeedbackStore {
/// Whether `baml feedback` sends anything from this machine.
#[serde(default = "default_true")]
enabled: bool,
/// Reports from this machine, oldest first.
#[serde(default)]
reports: Vec<FeedbackRecord>,View on GitHub (pinned to bd85ce9dee)
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.
Example fix
// before
baml feedback --payload '"My title"'
// after
baml feedback --payload '{"title": "My title"}' Defensive patterns
Strategy: validation
Validate before calling
const payload = JSON.parse(raw);
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {
throw new Error('feedback payload must be a JSON object like {"title": "..."}');
} Type guard
function isJsonObject(v: unknown): v is Record<string, unknown> {
return typeof v === 'object' && v !== null && !Array.isArray(v);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- unknown feedback field(s) {}; only "title" and "description"
- feedback field "{key}" must be a string
- feedback needs a title; pass --title "..." or a JSON payload
- invalid Go SDK import path `{import_path}`
- project name cannot be empty
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/eeb0ba3d18f5a4db.
Report an issue: GitHub.