{"record":{"id":"2ec5f52c4da49054","repo":"zeroclaw-labs/zeroclaw","slug":"unsupported-auth-profile-kind-other","errorCode":null,"errorMessage":"Unsupported auth profile kind: {other}","messagePattern":"Unsupported auth profile kind: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/auth/profiles.rs","lineNumber":642,"sourceCode":"    #[serde(default = \"default_now_rfc3339\")]\n    updated_at: String,\n    #[serde(default)]\n    metadata: BTreeMap<String, String>,\n}\n\nfn default_schema_version() -> u32 {\n    CURRENT_SCHEMA_VERSION\n}\n\nfn default_now_rfc3339() -> String {\n    Utc::now().to_rfc3339()\n}\n\nfn parse_profile_kind(value: &str) -> Result<AuthProfileKind> {\n    match value {\n        \"oauth\" => Ok(AuthProfileKind::OAuth),\n        \"token\" => Ok(AuthProfileKind::Token),\n        other => anyhow::bail!(\"Unsupported auth profile kind: {other}\"),\n    }\n}\n\nfn profile_kind_to_string(kind: AuthProfileKind) -> &'static str {\n    match kind {\n        AuthProfileKind::OAuth => \"oauth\",\n        AuthProfileKind::Token => \"token\",\n    }\n}\n\nfn parse_optional_datetime(value: Option<&str>) -> Result<Option<DateTime<Utc>>> {\n    value.map(parse_datetime).transpose()\n}\n\nfn parse_datetime(value: &str) -> Result<DateTime<Utc>> {\n    DateTime::parse_from_rfc3339(value)\n        .map(|dt| dt.with_timezone(&Utc))\n        .with_context(|| format!(\"Invalid RFC3339 timestamp: {value}\"))","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/auth/profiles.rs#L624-L660","documentation":"`parse_profile_kind` maps each persisted profile's `kind` string to `AuthProfileKind`; only `\"oauth\"` and `\"token\"` (exact lowercase) are valid. Any other value aborts the entire `load_locked` pass, so a single malformed profile makes the whole store unreadable — the error names the offending kind string.","triggerScenarios":"A hand-edited auth-profiles.json containing kind `\"API-Key\"`, `\"OAuth\"` (wrong case), `\"\"`, or a future kind; a store written by a newer version that introduced kinds this binary does not know.","commonSituations":"Manual edits to the state file; external tooling writing its own profile entries into auth-profiles.json; version skew after downgrade.","solutions":["Set the profile's `kind` to exactly `\"oauth\"` or `\"token\"` in auth-profiles.json","Remove the malformed profile entry if it is not needed","Create profiles through `AuthProfile::new_oauth`/`new_token` plus `upsert_profile` instead of editing the file","If the kind came from a newer version, upgrade the binary rather than editing data"],"exampleFix":"// before (auth-profiles.json)\n\"kind\": \"API-Key\"\n\n// after\n\"kind\": \"token\"","handlingStrategy":"validation","validationCode":"let raw = tokio::fs::read_to_string(store.path()).await?;\nlet v: serde_json::Value = serde_json::from_str(&raw)?;\nlet kinds_ok = v[\"profiles\"].as_object().map_or(true, |m| {\n    m.values().all(|p| matches!(p[\"kind\"].as_str(), Some(\"oauth\") | Some(\"token\")))\n});\nif !kinds_ok { /* fix or strip the offending entry before store operations */ }","typeGuard":null,"tryCatchPattern":"match store.load().await {\n    Ok(d) => d,\n    Err(e) if e.to_string().contains(\"Unsupported auth profile kind\") => {\n        return Err(anyhow!(\"edit {} : kind must be \\\"oauth\\\" or \\\"token\\\"\", store.path().display()));\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Create profiles via AuthProfile::new_oauth/new_token and upsert_profile — never edit the JSON by hand","Validate kind strings after any manual state-file edit","Keep external tools out of the store's write path"],"tags":["auth","profiles","parsing","config","rust"],"backgroundTag":"invalid-config-value","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}