{"record":{"id":"06f8160f5606eb03","repo":"can1357/oh-my-pi","slug":"unsupported-language-value-supported","errorCode":null,"errorMessage":"Unsupported language '{value}'. Supported: {}","messagePattern":"Unsupported language '(.+?)'\\. Supported: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/pi-ast/src/ops.rs","lineNumber":73,"sourceCode":"#[derive(Debug, Clone)]\npub struct CompiledRewrite {\n\tpub out:      String,\n\tpub patterns: Vec<Pattern>,\n}\n\n#[must_use]\npub fn resolve_strictness(value: Option<AstMatchStrictness>) -> MatchStrictness {\n\tvalue.map_or(MatchStrictness::Smart, Into::into)\n}\n\n#[must_use]\npub fn supported_lang_list() -> String {\n\tSupportLang::sorted_aliases().join(\", \")\n}\n\npub fn resolve_supported_lang(value: &str) -> Result<SupportLang> {\n\tSupportLang::from_alias(value).ok_or_else(|| {\n\t\tanyhow!(\"Unsupported language '{value}'. Supported: {}\", supported_lang_list())\n\t})\n}\n\npub fn resolve_language(lang: Option<&str>, file_path: &Path) -> Result<SupportLang> {\n\tif let Some(lang) = lang.map(str::trim).filter(|lang| !lang.is_empty()) {\n\t\treturn resolve_supported_lang(lang);\n\t}\n\tSupportLang::from_path(file_path).ok_or_else(|| {\n\t\tanyhow!(\n\t\t\t\"Unable to infer language from file extension: {}. Specify `lang` explicitly.\",\n\t\t\tfile_path.display()\n\t\t)\n\t})\n}\n\n#[must_use]\npub fn is_supported_file(file_path: &Path, explicit_lang: Option<&str>) -> bool {\n\tif explicit_lang.is_some() {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-ast/src/ops.rs#L55-L91","documentation":"The RPC client validates todo item seeds passed to set_todos() against the known TodoStatus enum (_TODO_STATUS_VALUES). If a seed dict carries a 'status' string that is not one of the supported statuses, RpcError is raised before anything is sent to the server. This fails fast so invalid state never reaches the RPC peer.","triggerScenarios":"Calling set_todos() with a seed dict whose 'status' is a string not in _TODO_STATUS_VALUES, e.g. status=\"in-progress\" when the library expects \"in_progress\", or a typo like \"done \" with trailing whitespace, or an arbitrary free-form status from user input.","commonSituations":"Hand-writing todo JSON with kebab-case statuses, importing todos from another tool that uses different status vocabulary, or piping user-supplied status strings straight into set_todos() without normalizing.","solutions":["Use one of the exact TodoStatus string values the library defines (check _TODO_STATUS_VALUES in omp_rpc/client.py).","Normalize/trim incoming status strings and map external vocabularies to TodoStatus before calling set_todos().","Omit 'status' entirely so the seed defaults to \"pending\" (the non-string branch).","Wrap set_todos() in try/except RpcError to surface a friendly validation message."],"exampleFix":"// before\nclient.set_todos([{\"id\": \"t1\", \"title\": \"Fix bug\", \"status\": \"in-progress\"}])\n// after\nclient.set_todos([{\"id\": \"t1\", \"title\": \"Fix bug\", \"status\": \"in_progress\"}])","handlingStrategy":"validation","validationCode":"ALLOWED = {\"pending\", \"in_progress\", \"completed\", \"cancelled\"}  # mirror _TODO_STATUS_VALUES\nraw = seed.get(\"status\")\nif isinstance(raw, str) and raw not in ALLOWED:\n    raise ValueError(f\"todo status {raw!r} not one of {sorted(ALLOWED)}\")","typeGuard":"def is_todo_status(v: object) -> TypeGuard[str]:\n    return isinstance(v, str) and v in _TODO_STATUS_VALUES","tryCatchPattern":"try:\n    client.set_todos(seeds)\nexcept RpcError as exc:\n    if \"Unsupported todo status\" in str(exc):\n        logger.warning(\"bad todo status: %s\", exc)\n    else:\n        raise","preventionTips":["Always assign statuses from the TodoStatus literal type, never free strings.","Normalize/strip external status vocabularies via a mapping table before set_todos().","Omit 'status' when you mean pending — the default branch handles it."],"tags":["validation","rpc","todos","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}