{"record":{"id":"f08d63d29984c673","repo":"wasmerio/wasmer","slug":"no-value-found-for-secret-with-name","errorCode":null,"errorMessage":"No value found for secret with name '{}'","messagePattern":"No value found for secret with name '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/cli/src/commands/app/secrets/utils/mod.rs","lineNumber":49,"sourceCode":"    secret_name: &str,\n) -> anyhow::Result<Option<BackendSecret>> {\n    wasmer_backend_api::query::get_app_secret_by_name(client, app_id, secret_name).await\n}\npub(crate) async fn get_secrets(\n    client: &WasmerClient,\n    app_id: &str,\n) -> anyhow::Result<Vec<wasmer_backend_api::types::Secret>> {\n    wasmer_backend_api::query::get_all_app_secrets(client, app_id).await\n}\n\npub(crate) async fn get_secret_value(\n    client: &WasmerClient,\n    secret: &wasmer_backend_api::types::Secret,\n) -> anyhow::Result<String> {\n    wasmer_backend_api::query::get_app_secret_value_by_id(client, secret.id.clone().into_inner())\n        .await?\n        .ok_or_else(|| {\n            anyhow::anyhow!(\n                \"No value found for secret with name '{}'\",\n                secret.name.bold()\n            )\n        })\n}\n\npub(crate) async fn get_secret_value_by_name(\n    client: &WasmerClient,\n    app_id: &str,\n    secret_name: &str,\n) -> anyhow::Result<String> {\n    match get_secret_by_name(client, app_id, secret_name).await? {\n        Some(secret) => get_secret_value(client, &secret).await,\n        None => anyhow::bail!(\"No secret found with name {secret_name} for app {app_id}\"),\n    }\n}\n\npub(crate) async fn reveal_secrets(","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/app/secrets/utils/mod.rs#L31-L67","documentation":"`get_secret_value` fetches an app secret's value by its ID via the Wasmer backend GraphQL API. The query can succeed but return `None` for the value; this error converts that None into a descriptive failure naming the secret. It means the backend knows the secret exists but holds (or exposes) no value for it.","triggerScenarios":"`wasmer app secrets get <name>` / `reveal` path: `get_app_secret_value_by_id(client, secret.id)` resolves to `None` for a secret that exists in the app's secret list.","commonSituations":"Secret was created but its value was never set; value was deleted server-side; using a stale local cache/listing where the secret was since rotated or removed; insufficient permissions to read the secret value.","solutions":["Re-create the secret with the intended value (`wasmer app secrets set <name> <value>`) and retry.","Refresh the secret listing (`wasmer app secrets list`) to ensure the secret ID is current, then reveal again.","Verify your account has permission to read secret values for this app.","Check the Wasmer backend status if the value mysteriously disappeared."],"exampleFix":"// before\nlet value = get_secret_value_by_name(&client, &app_id, \"API_KEY\").await?;\n// after\nmatch get_secret_value_by_name(&client, &app_id, \"API_KEY\").await {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"No value found\") => {\n        eprintln!(\"secret API_KEY has no value; setting it first...\");\n        set_secret(&client, &app_id, \"API_KEY\", \"new-value\").await?;\n        get_secret_value_by_name(&client, &app_id, \"API_KEY\").await?\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"try-catch","validationCode":"// pre-check the secret exists and is listed before reading its value\nlet secrets = list_app_secrets(client, &app_id).await?;\nif !secrets.iter().any(|s| s.name == \"API_KEY\") {\n    eprintln!(\"secret API_KEY does not exist; create it first\");\n}","typeGuard":null,"tryCatchPattern":"match get_secret_value_by_name(&client, &app_id, name).await {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"No value found for secret\") => {\n        // secret exists but has no value — prompt to set it\n        set_secret_value(client, app_id, name).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Set a value whenever you create a secret; never create empty secrets.","Refresh secret listings before reading so IDs are current.","Confirm your account/role can read secret values, not just list names."],"tags":["graphql","secrets","backend-api"],"backgroundTag":"missing-secret-value","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}