{"record":{"id":"901911a65c605348","repo":"warpdotdev/warp","slug":"error-prefix-run-id-err","errorCode":null,"errorMessage":"{error_prefix} '{run_id}': {err}","messagePattern":"\\{error_prefix\\} '\\{run_id\\}': \\{err\\}","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/common.rs","lineNumber":83,"sourceCode":"    } else {\n        let suggestions = valid_ids\n            .iter()\n            .map(|id| id.to_string())\n            .collect::<Vec<_>>()\n            .join(\", \");\n        Err(anyhow::anyhow!(\n            \"Unknown model id '{model_id}'. Try one of: {suggestions}\"\n        ))\n    }\n}\n\npub(super) fn parse_ambient_task_id(\n    run_id: &str,\n    error_prefix: &str,\n) -> anyhow::Result<AmbientAgentTaskId> {\n    run_id\n        .parse()\n        .map_err(|err| anyhow::anyhow!(\"{error_prefix} '{run_id}': {err}\"))\n}\n\npub(super) fn set_ambient_task_context_from_run_id(\n    ctx: &AppContext,\n    run_id: &str,\n) -> anyhow::Result<AmbientAgentTaskId> {\n    let task_id = parse_ambient_task_id(run_id, \"Invalid run ID\")?;\n    ServerApiProvider::handle(ctx)\n        .as_ref(ctx)\n        .get()\n        .set_ambient_agent_task_id(Some(task_id));\n    Ok(task_id)\n}\n\n/// Resolve the owner of a new cloud object. This resolution is based on the CLI `--team` and `--personal` flags.\n///\n/// If `team_flag` is true, attempts to get the current team UID (errors if not on a team).\n/// If `user_flag` is true, gets the current user's UID.","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/common.rs#L65-L101","documentation":"`parse_ambient_task_id` runs `run_id.parse::<AmbientAgentTaskId>()` and on failure wraps the parser's own error with a caller-supplied prefix (e.g. 'Invalid run ID', 'Invalid OZ_RUN_ID'). The string is not shaped like an ambient agent task id; the appended `{err}` names the exact format violation.","triggerScenarios":"Passing a --run-id (or OZ_RUN_ID, or a run id from another source) whose string does not match the AmbientAgentTaskId format — truncated copy, a different kind of id (conversation id, api key uid), or stray whitespace/newlines.","commonSituations":"Copy-paste truncation; using a conversation id where a run/task id is expected; extra quotes or newlines in env vars; ids taken from a different product surface.","solutions":["Re-copy the full run id from the output that produced it (e.g. the task list)","Confirm you are using a run/task id, not a conversation id or API key uid","Trim whitespace and newlines before passing the value","Read the appended parser error — it states the exact format problem"],"exampleFix":"# before\nRUN_ID=$(cat id.txt)   # id.txt has a trailing newline\n# after\nRUN_ID=$(tr -d '[:space:]' < id.txt)","handlingStrategy":"type-guard","validationCode":"fn parse_run_id_checked(s: &str) -> anyhow::Result<AmbientAgentTaskId> {\n    s.trim().parse().map_err(|err| anyhow!(\"Invalid run ID '{s}': {err}\"))\n}","typeGuard":"fn is_valid_run_id(s: &str) -> bool {\n    s.trim() == s && s.parse::<AmbientAgentTaskId>().is_ok()\n}","tryCatchPattern":"match run_id.parse::<AmbientAgentTaskId>() {\n    Ok(task_id) => Ok(task_id),\n    Err(err) => Err(anyhow!(\"{error_prefix} '{run_id}': {err}\")), // surface the parser's exact reason\n}","preventionTips":["Trim ids before use","Parse-validate ids at input boundaries","Never substitute other-id types (conversation, api key) for run ids"],"tags":["run-id","parsing","validation","ambient-agent"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}