{"record":{"id":"f589e1b2d02fa867","repo":"wasmerio/wasmer","slug":"app-deletion-failed-for-an-unknown-reason","errorCode":null,"errorMessage":"App deletion failed for an unknown reason","messagePattern":"App deletion failed for an unknown reason","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/backend-api/src/query.rs","lineNumber":1978,"sourceCode":"        Err(GraphQLApiFailure::from_errors(\n            \"could not publish app\",\n            res.errors,\n        ))\n    }\n}\n\n/// Delete an app.\npub async fn delete_app(client: &WasmerClient, app_id: String) -> Result<(), anyhow::Error> {\n    let res = client\n        .run_graphql_strict(types::DeleteApp::build(types::DeleteAppVars {\n            app_id: app_id.into(),\n        }))\n        .await?\n        .delete_app\n        .context(\"API did not return data for the delete_app mutation\")?;\n\n    if !res.success {\n        bail!(\"App deletion failed for an unknown reason\");\n    }\n\n    Ok(())\n}\n\n/// Get all namespaces accessible by the current user.\npub async fn user_namespaces(\n    client: &WasmerClient,\n) -> Result<Vec<types::Namespace>, anyhow::Error> {\n    let user = client\n        .run_graphql(types::GetCurrentUserWithNamespaces::build(\n            types::GetCurrentUserWithNamespacesVars {\n                namespace_role: None,\n            },\n        ))\n        .await?\n        .viewer\n        .context(\"not logged in\")?;","sourceCodeStart":1960,"sourceCodeEnd":1996,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/backend-api/src/query.rs#L1960-L1996","documentation":"After issuing the delete_app mutation, the code checks res.success; if the backend reports the mutation did not succeed (without a more specific error), the library bails with 'App deletion failed for an unknown reason'. This is a catch-all for a failed mutation that returned no descriptive error.","triggerScenarios":"Calling delete_app where the GraphQL mutation executes but returns success=false — typically due to insufficient permissions, the app already being deleted, or backend-side constraints (running instances, attached domains).","commonSituations":"Token lacking delete rights on the namespace; deleting an app twice in a race; app has live instances that the backend refuses to tear down silently.","solutions":["Verify the auth token has delete permissions for the app's namespace.","Check the app still exists and has no running instances/domains blocking deletion; stop instances first, then delete.","Retry the delete once and inspect the app with get_app to confirm current state (it may have already been deleted).","Report to Wasmer backend team if success=false persists with no error payload — the API should return a reason."],"exampleFix":"// before\nif !res.success {\n    bail!(\"App deletion failed for an unknown reason\");\n}\n// after (caller-side guard)\nlet app = get_app(&client, &app_id).await.ok();\nif app.is_some() {\n    delete_app(&client, &app_id).await?;\n    if get_app(&client, &app_id).await.is_ok() {\n        anyhow::bail!(\"app {app_id} still exists after deletion attempt\");\n    }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"delete_app(&client, &app_id).await\n    .map_err(|e| anyhow::anyhow!(\"app deletion failed: {e:#}\"))?;\n// verify deletion actually took effect\nif get_app(&client, &app_id).await.is_ok() {\n    anyhow::bail!(\"app {app_id} still exists after delete_app reported success\");\n}","preventionTips":["Ensure the token has delete permission on the app's namespace","Stop running instances and detach domains before deleting","Confirm the app via get_app before deleting; treat 'already gone' as success"],"tags":["backend-api","graphql","mutation","permissions","delete"],"backgroundTag":"mutation-failed-unknown-reason","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}