{"record":{"id":"6dccce24f98e79b5","repo":"windmill-labs/windmill","slug":"error-occurred-for-http-route-at-route-path-e","errorCode":null,"errorMessage":"Error occurred for HTTP route at route path: {}, error: {}","messagePattern":"Error occurred for HTTP route at route path: (.+?), error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-trigger-http/src/handler.rs","lineNumber":254,"sourceCode":"        )\n        .execute(&mut *tx)\n        .await?;\n    Ok(())\n}\n\npub async fn create_many_http_triggers(\n    authed: ApiAuthed,\n    Extension(db): Extension<DB>,\n    Extension(user_db): Extension<UserDB>,\n    Path(w_id): Path<String>,\n    Json(new_http_triggers): Json<Vec<TriggerData<HttpConfigRequest>>>,\n) -> Result<(StatusCode, String)> {\n    // Admin check for instance-wide routes is done per-trigger in insert_new_trigger_into_db\n\n    let handler = HttpTrigger;\n\n    let error_wrapper = |route_path: &str, error: Error| -> Error {\n        anyhow::anyhow!(\n            \"Error occurred for HTTP route at route path: {}, error: {}\",\n            route_path,\n            error\n        )\n        .into()\n    };\n\n    let mut route_path_keys = Vec::with_capacity(new_http_triggers.len());\n\n    for new_http_trigger in new_http_triggers.iter() {\n        // Per-item write scope, matching the single-create handler. The bulk\n        // endpoint must not let a path-scoped token create triggers outside it.\n        check_scopes(&authed, || {\n            format!(\"http_triggers:write:{}\", &new_http_trigger.base.path)\n        })?;\n\n        // This route inserts directly, bypassing the shared create handler.\n        // `error_wrapper` would turn the rejection into a 500.","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-trigger-http/src/handler.rs#L236-L272","documentation":"HTTP trigger batch creation (create_many_http_triggers) wraps any per-trigger failure with the offending route path via this helper, producing 'Error occurred for HTTP route at route path: {path}, error: {cause}'. The wrapper preserves the underlying error (commonly uniqueness/duplicate-path violations) while identifying which route failed.","triggerScenarios":"POSTing multiple HTTP triggers where one or more route paths collide with an existing trigger's path (same workspace/method/path), or where insert_new_trigger_into_db fails validation for a specific path (e.g. instance-wide route admin check failing).","commonSituations":"Bulk-importing triggers that already exist; two triggers defined with the same path/method; case or trailing-slash variations of an existing path; deploying to a workspace that already has the route registered.","solutions":["Read the wrapped {error} portion to identify the root cause (usually a duplicate-path DB conflict)","Check existing HTTP triggers in the workspace and remove/rename the colliding path","Use upsert semantics or delete the old trigger before re-creating in bulk","Verify you are deploying to the intended workspace (path uniqueness is per workspace)","Ensure proper admin permissions when registering instance-wide routes"],"exampleFix":"// before\nPOST /http_triggers/create_many  body: [{\"path\": \"/api/x\"}, {\"path\": \"/api/x\"}]\n// after\nPOST /http_triggers/create_many  body: [{\"path\": \"/api/x\"}, {\"path\": \"/api/y\"}]","handlingStrategy":"validation","validationCode":"// before creating, check path uniqueness in the workspace\nconst existing = await api.listHttpTriggers(workspace);\nconst taken = new Set(existing.map(t => `${t.method} ${t.path}`));\nconst clashes = triggers.filter(t => taken.has(`${t.method} ${t.path}`));\nif (clashes.length) throw new Error(`routes already registered: ${clashes.map(c => c.path).join(\", \")}`);","typeGuard":null,"tryCatchPattern":"try {\n  await api.createManyHttpTriggers(workspace, triggers);\n} catch (e) {\n  const m = String(e).match(/route path: ([^,]+), error: (.*)$/s);\n  if (m) throw new Error(`failed to create route '${m[1]}': ${m[2]}`);\n  throw e;\n}","preventionTips":["List existing HTTP triggers before bulk create and dedupe by (method, path)","Use deterministic path generation per workspace and never hardcode shared paths","Delete-or-upsert instead of blind create when redeploying trigger sets","Remember path uniqueness is per workspace — validate against the target workspace only"],"tags":["http-triggers","routes","conflict","validation"],"backgroundTag":"duplicate-http-route-path","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}