{"record":{"id":"001ff75e4791bcf8","repo":"neondatabase/neon","slug":"failed-to-configure-failpoints-err-msg","errorCode":null,"errorMessage":"Failed to configure failpoints: {err_msg}","messagePattern":"Failed to configure failpoints: (.+?)","errorType":"http","errorClass":"ApiError","httpStatus":400,"severity":"warning","filePath":"libs/http-utils/src/failpoints.rs","lineNumber":42,"sourceCode":"    mut request: Request<Body>,\n    _cancel: CancellationToken,\n) -> Result<Response<Body>, ApiError> {\n    if !fail::has_failpoints() {\n        return Err(ApiError::BadRequest(anyhow::anyhow!(\n            \"Cannot manage failpoints because neon was compiled without failpoints support\"\n        )));\n    }\n\n    let failpoints: ConfigureFailpointsRequest = json_request(&mut request).await?;\n    for fp in failpoints {\n        tracing::info!(\"cfg failpoint: {} {}\", fp.name, fp.actions);\n\n        // We recognize one extra \"action\" that's not natively recognized\n        // by the failpoints crate: exit, to immediately kill the process\n        let cfg_result = apply_failpoint(&fp.name, &fp.actions);\n\n        if let Err(err_msg) = cfg_result {\n            return Err(ApiError::BadRequest(anyhow::anyhow!(\n                \"Failed to configure failpoints: {err_msg}\"\n            )));\n        }\n    }\n\n    json_response(StatusCode::OK, ())\n}\n","sourceCodeStart":24,"sourceCodeEnd":50,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/libs/http-utils/src/failpoints.rs#L24-L50","documentation":"Returned as HTTP 400 BadRequest by failpoints_handler in neon's http-utils when apply_failpoint(name, actions) — which wraps fail::cfg plus the extra 'exit' action — returns an Err. The actions string must follow the failpoints-crate format (e.g. 'off', 'return', 'return(42)', 'pause', '10%return', 'exit'); an unparseable action or an unknown directive produces an error message that is embedded into this response.","triggerScenarios":"POST /failpoints with body [{\"name\":\"...\",\"actions\":\"sleep(100)\"}] where 'sleep(100)' is not valid syntax (the crate uses 'delay'/'pause' style actions); also malformed probability like 'return(abc)' or an actions string the failpoints cfg parser rejects. The first failing entry aborts the whole request with 400.","commonSituations":"Test scripts assuming fail crate action names that differ from the failpoints crate ('sleep' vs 'delay'); copy-pasted actions from docs of a different failpoint library; typos like 'retrn' or 'pause 100' instead of 'pause(100)'.","solutions":["Check the err_msg in the response — it names the exact action string that failed to parse","Use valid actions: off, return, return(value), pause, delay, probability-prefixed forms like '10%return', or the neon extension 'exit'","Validate the actions string against the failpoints crate cfg syntax before sending the batch","Fix only the failing entry; entries before it were already applied, so re-send the corrected one"],"exampleFix":"# before\ncurl -X POST localhost:9898/failpoints -d '[{\"name\":\"fp1\",\"actions\":\"sleep(1000)\"}]'\n# 400 Failed to configure failpoints\n\n# after\ncurl -X POST localhost:9898/failpoints -d '[{\"name\":\"fp1\",\"actions\":\"pause\"}]'","handlingStrategy":"validation","validationCode":"# Validate actions against the accepted grammar before sending:\nACTION_RE='^(off|return(\\([^)]*\\))?|pause|delay|exit|[0-9]+%(return(\\([^)]*\\))?|pause|delay|exit))$'\nfor fp in \"${FAILPOINTS[@]}\"; do\n  name=\"${fp%%=*}\"; actions=\"${fp#*=}\"\n  [[ \"$actions\" =~ $ACTION_RE ]] || { echo \"bad actions: $actions\"; exit 1; }\ndone","typeGuard":"function isValidFailpointAction(a) {\n  return /^(off|return(\\([^)]*\\))?|pause|delay|exit|\\d+%(&?.*)?)$/.test(a);\n}","tryCatchPattern":"# Report the offending entry and continue rather than aborting the scenario:\nif ! curl -sf -X POST localhost:9898/failpoints -d @fp.json; then\n  echo \"failpoint config rejected; check actions syntax per the failpoints crate cfg format\"\n  exit 1\nfi","preventionTips":["Generate actions strings from a library of known-good templates","Remember entries before the failing one were already applied — track applied state","Use the crate's documented cfg format; do not port syntax from other failpoint libraries"],"tags":["neon","http-utils","failpoints","testing","action-syntax"],"backgroundTag":"invalid-test-configuration","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}