{"record":{"id":"59f3964c352ebbd5","repo":"neondatabase/neon","slug":"invalid-format-format","errorCode":null,"errorMessage":"invalid format {format}","messagePattern":"invalid format (.+?)","errorType":"http","errorClass":"ApiError","httpStatus":400,"severity":"warning","filePath":"libs/http-utils/src/endpoint.rs","lineNumber":379,"sourceCode":"        }\n    });\n\n    Ok(response)\n}\n\n/// Generates CPU profiles.\npub async fn profile_cpu_handler(req: Request<Body>) -> Result<Response<Body>, ApiError> {\n    enum Format {\n        Pprof,\n        Svg,\n    }\n\n    // Parameters.\n    let format = match get_query_param(&req, \"format\")?.as_deref() {\n        None => Format::Pprof,\n        Some(\"pprof\") => Format::Pprof,\n        Some(\"svg\") => Format::Svg,\n        Some(format) => return Err(ApiError::BadRequest(anyhow!(\"invalid format {format}\"))),\n    };\n    let seconds = match parse_query_param(&req, \"seconds\")? {\n        None => 5,\n        Some(seconds @ 1..=60) => seconds,\n        Some(_) => return Err(ApiError::BadRequest(anyhow!(\"duration must be 1-60 secs\"))),\n    };\n    let frequency_hz = match parse_query_param(&req, \"frequency\")? {\n        None => 99,\n        Some(1001..) => return Err(ApiError::BadRequest(anyhow!(\"frequency must be <=1000 Hz\"))),\n        Some(frequency) => frequency,\n    };\n    let force: bool = parse_query_param(&req, \"force\")?.unwrap_or_default();\n\n    // Take the profile.\n    static PROFILE_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));\n    static PROFILE_CANCEL: Lazy<Notify> = Lazy::new(Notify::new);\n\n    let report = {","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/libs/http-utils/src/endpoint.rs#L361-L397","documentation":"Returned as HTTP 400 BadRequest by profile_cpu_handler (the /profile/cpu debugging endpoint in neon's http-utils) when the optional format query parameter is present but is not one of the accepted values 'pprof' or 'svg'. The parameter is matched exactly (case-sensitive), and omitting it entirely is valid (defaults to pprof).","triggerScenarios":"GET /profile/cpu?format=json, ?format=SVG, or ?format=pprof%2Bgzip — any format value other than exactly 'pprof' or 'svg' returns this 400.","commonSituations":"Grafana/pyroscope scrape config changed to request a new format; typo or uppercase value in the format param; tooling assuming flamegraph or json is supported.","solutions":["Use ?format=pprof (default) or ?format=svg exactly, lowercase","Omit the format parameter if the pprof protobuf output is acceptable","Check for URL-encoding mistakes that alter the value (e.g. svg%21)"],"exampleFix":"# before\ncurl 'http://localhost:9898/profile/cpu?format=flamegraph'   # 400 invalid format\n\n# after\ncurl 'http://localhost:9898/profile/cpu?format=svg'","handlingStrategy":"validation","validationCode":"# Validate before scraping:\nformat=\"${FORMAT:-pprof}\"\n[ \"$format\" = pprof ] || [ \"$format\" = svg ] || { echo \"bad format\"; exit 1; }\ncurl \"http://localhost:9898/profile/cpu?format=$format\"","typeGuard":"isPprofFormat(fmt) { return fmt === \"pprof\" || fmt === \"svg\"; }","tryCatchPattern":null,"preventionTips":["Pin scrape configs to the documented lowercase values","Default to omitting format when pprof is acceptable","Centralize endpoint URLs in one config to keep values consistent across tools"],"tags":["neon","http-utils","profiling","query-param","cpu-profile"],"backgroundTag":"invalid-query-parameter","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}