{"record":{"id":"8cf72fde13b54083","repo":"BoundaryML/baml","slug":"no-credentials-found","errorCode":null,"errorMessage":"No credentials found","messagePattern":"No credentials found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/cli/src/propelauth.rs","lineNumber":349,"sourceCode":"            anyhow::bail!(\"Failed to refresh access token: {}\", response.text().await?);\n        }\n\n        let body: RefreshAccessTokenResponse = response\n            .json()\n            .await\n            .context(\"Failed to parse refresh access token response\")?;\n\n        Ok(body)\n    }\n\n    pub(crate) fn read_from_storage() -> Result<Self> {\n        let creds_path = app_strategy()\n            .context(\"Unable to get project directories\")?\n            .in_config_dir(\"creds.json\");\n\n        // TODO: if these fail we should tell the user to login\n        if !creds_path.exists() {\n            anyhow::bail!(\"No credentials found\");\n        }\n\n        // TODO: if these fail we should tell the user to login\n        let creds_content = std::fs::read_to_string(creds_path)?;\n        let creds: Self = serde_json::from_str(&creds_content)?;\n\n        Ok(creds)\n    }\n\n    pub(crate) fn write_to_storage(&self) -> Result<()> {\n        let strategy = app_strategy().context(\"Unable to get project directories\")?;\n        let config_dir = strategy.config_dir();\n        std::fs::create_dir_all(&config_dir)?;\n        let creds_path = config_dir.join(\"creds.json\");\n\n        let creds_content = serde_json::to_string(&self)?;\n\n        log::debug!(\"Writing credentials to {creds_path:?}\");","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/cli/src/propelauth.rs#L331-L367","documentation":"Credential lookup failure in the PropelAuth auth client: the stored credentials file (creds.json in the user's config dir) is absent, so there is no refresh token to use. It fires from read_from_storage when the user has never logged in on this machine or the config directory was wiped; the code's TODO notes the intent to tell the user to log in.","triggerScenarios":"Calling any authenticated CLI command (deploy, whoami, etc.) when read_from_storage finds creds.json absent in the OS config directory.","commonSituations":"Fresh machine or fresh install; running as a different user/OS user so the config dir differs; setting HOME/XDG_CONFIG_HOME differently in CI; deleting credentials manually.","solutions":["Run `baml login` to create the credentials file","Check that you run the command as the same OS user that logged in (same config dir)","In CI, restore/cache the creds.json or inject auth via environment rather than interactive login"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { execSync } = require('child_process');\nconst cfgDir = process.env.XDG_CONFIG_HOME || require('os').homedir() + '/.config';\nlet loggedIn = true;\ntry { execSync('baml whoami', { stdio: 'ignore' }); } catch { loggedIn = false; }\nif (!loggedIn) execSync('baml login', { stdio: 'inherit' });","typeGuard":null,"tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (String(e).includes('No credentials found')) {\n    execSync('baml login', { stdio: 'inherit' });\n  }\n}","preventionTips":["Run `baml login` before scripted authenticated commands","Use a consistent OS user/HOME in CI so the config dir matches","Cache creds.json securely in CI pipelines"],"tags":["auth","credentials","cli"],"backgroundTag":"missing-credentials","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}