{"record":{"id":"de9b10e332cc71cf","repo":"BoundaryML/baml","slug":"feedback-needs-a-title-pass-title-or-a-json-payload-with-a","errorCode":null,"errorMessage":"feedback needs a title; pass --title \"...\" or a JSON payload with a \"title\" field","messagePattern":"feedback needs a title; pass --title \"\\.\\.\\.\" or a JSON payload with a \"title\" field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/feedback_command.rs","lineNumber":409,"sourceCode":"                 \\\"description\\\" are sent (attach files with --files)\",\n                unknown.join(\", \")\n            ));\n        }\n\n        // Validate types, not just names: a non-string field would ship to\n        // PostHog while the preview and the local record (which read via\n        // `as_str`) silently dropped it.\n        for key in [\"title\", \"description\"] {\n            if let Some(value) = obj.get(key)\n                && !value.is_string()\n            {\n                return Err(anyhow::anyhow!(\"feedback field \\\"{key}\\\" must be a string\"));\n            }\n        }\n\n        let title = obj.get(\"title\").and_then(Value::as_str).unwrap_or(\"\");\n        if title.trim().is_empty() {\n            return Err(anyhow::anyhow!(\n                \"feedback needs a title; pass --title \\\"...\\\" or a JSON payload \\\n                 with a \\\"title\\\" field\"\n            ));\n        }\n        Ok(from_json)\n    }\n\n    /// Shows exactly what a report contains and how it is attributed.\n    fn print_preview(&self, payload: &Value, identified: bool, email: Option<&str>) {\n        if identified {\n            println!(\n                \"reporting to Boundary as {}:\",\n                email.unwrap_or(\"your account\")\n            );\n        } else {\n            println!(\"reporting to Boundary anonymously:\");\n        }\n        println!();","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/feedback_command.rs#L391-L427","documentation":"`baml feedback` requires a non-empty title. If the --json payload's title is missing, non-string, or whitespace-only (and no --title flag supplied a value), the command rejects the payload since an untitled feedback record is useless.","triggerScenarios":"`baml feedback --json '{\"description\":\"x\"}'` with no --title, or --json '{\"title\":\"   \"}' / '{\"title\":\"\"}' — obj.get(\"title\").as_str().trim() is empty.","commonSituations":"Passing only a description expecting it to suffice; shell quoting stripping the title; piping JSON built from a template lacking a title field.","solutions":["Add --title \"...\" on the command line.","Include a non-empty \"title\" string in the --json payload.","If the title comes from a variable, ensure it is non-empty after trimming before invoking the command."],"exampleFix":"# before\nbaml feedback --json '{\"description\":\"crash on build\"}'\n# after\nbaml feedback --title \"crash on build\" --json '{\"description\":\"stack trace follows\"}'","handlingStrategy":"validation","validationCode":"# require a non-empty title before invoking\njq -e '.title != null and (.title | type == \"string\") and (.title | trim | length > 0)' payload.json \\\n  && baml feedback --json \"$(cat payload.json)\" \\\n  || { echo \"title required\"; exit 1; }","typeGuard":"const hasTitle = (p) => typeof p?.title === 'string' && p.title.trim().length > 0;","tryCatchPattern":"try {\n  run(`baml feedback --json '${payload}'`);\n} catch (e) {\n  if (String(e).includes('feedback needs a title')) {\n    run(`baml feedback --title \"untitled feedback\" --json '${payload}'`);\n  }\n}","preventionTips":["Always pass --title or ensure the JSON payload has a non-empty title","Trim user-supplied titles before sending","Add a pre-flight check in scripts that build feedback payloads"],"tags":["cli","validation","empty-required-field","feedback"],"backgroundTag":"missing-required-argument","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"}