Hmbown/CodeWhale · error
invalid Codewhale-owned ChatGPT OAuth generation; expected…
Error message
invalid Codewhale-owned ChatGPT OAuth generation; expected chatgpt-auth-<32 lowercase hex>.json
What it means
validate_chatgpt_oauth_generation is the ChatGPT twin of the xAI validator: it requires exactly "chatgpt-auth-<32 lowercase hex>.json" before chatgpt_oauth_generation_path or remove_chatgpt_oauth_generation will act on the value. The 32 hex chars identify a stored ChatGPT OAuth generation file owned by Codewhale.
Solutions
- Pass the bare file name matching "chatgpt-auth-" + 32 lowercase hex + ".json"
- Make sure you're using the ChatGPT API, not the xAI one, for chatgpt-auth files
- Regenerate the OAuth generation via the normal flow instead of hand-crafting the name
Example fix
// before
chatgpt_oauth_generation_path("xai-auth-3f9a1c0d7e2b4a6f8d1c3e5a7b9d0f2b.json")
// after
chatgpt_oauth_generation_path("chatgpt-auth-3f9a1c0d7e2b4a6f8d1c3e5a7b9d0f2b.json") Defensive patterns
Strategy: validation
Validate before calling
fn is_chatgpt_generation(v: &str) -> bool {
let hex = v.strip_prefix("chatgpt-auth-")
.and_then(|r| r.strip_suffix(".json"));
hex.map(|h| h.len() == 32 && h.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()))
.unwrap_or(false)
} Type guard
fn as_chatgpt_generation(v: &str) -> Option<&str> {
let hex = v.strip_prefix("chatgpt-auth-")?.strip_suffix(".json")?;
(hex.len() == 32 && hex.bytes().all(|b| b.is_ascii_hexdigit() && !b.is_ascii_uppercase()))
.then_some(v)
} Try / catch
match validate_chatgpt_oauth_generation(value) {
Ok(v) => chatgpt_oauth_generation_path(v),
Err(e) => eprintln!("bad generation name '{value}': {e}"),
} Prevention
- Don't mix up the xai-auth- and chatgpt-auth- prefixes when scripting
- Pass bare file names, never paths or URLs
- Prefer the library's list/remove helpers over manual directory scanning
When it happens
Trigger: Calling chatgpt_oauth_generation_path or remove_chatgpt_oauth_generation with a malformed generation name — wrong prefix (e.g. xai-auth-...), uppercase hex, wrong digest length, missing .json suffix, or a full path.
Common situations: Confusing the xAI and ChatGPT generation formats when scripting cleanup, passing directory-scanning results that include paths, or older stored references predating the strict naming convention.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- invalid Codewhale-owned xAI OAuth generation; expected…
- OAuth login is only supported for URL-based MCP servers
- agent profile provider cannot be empty
- agent profile provider must be a simple provider id
- api_key cannot be empty string
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/7abe7775e550a5f3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/config/src/xai_credentials.rs:84
bail!(
"invalid Codewhale-owned xAI OAuth generation; expected xai-auth-<32 lowercase hex>.json"
);
}
Ok(value)
}
#[must_use]
pub fn is_valid_chatgpt_oauth_generation(value: &str) -> bool {
is_valid_owned_oauth_generation(
value,
CHATGPT_OAUTH_GENERATION_PREFIX,
CHATGPT_OAUTH_GENERATION_SUFFIX,
)
}
pub fn validate_chatgpt_oauth_generation(value: &str) -> Result<&str> {
if !is_valid_chatgpt_oauth_generation(value) {
bail!(
"invalid Codewhale-owned ChatGPT OAuth generation; expected chatgpt-auth-<32 lowercase hex>.json"
);
}
Ok(value)
}
fn is_valid_owned_oauth_generation(value: &str, prefix: &str, suffix: &str) -> bool {
let path = Path::new(value);
if path.components().count() != 1
|| !matches!(path.components().next(), Some(Component::Normal(_)))
|| path.file_name().and_then(|name| name.to_str()) != Some(value)
{
return false;
}
let Some(id) = value
.strip_prefix(prefix)
.and_then(|value| value.strip_suffix(suffix))
else {View on GitHub (pinned to 73e0f67d83)