{"record":{"id":"f812dab8c664539a","repo":"openclaw/openclaw","slug":"profile-name-not-found","errorCode":null,"errorMessage":"profile \"${name}\" not found","messagePattern":"profile \"(.+?)\" not found","errorType":"exception","errorClass":"BrowserProfileNotFoundError","httpStatus":404,"severity":"error","filePath":"extensions/browser/src/browser/profiles-service.ts","lineNumber":244,"sourceCode":"    if (!name) {\n      throw new BrowserValidationError(\"profile name is required\");\n    }\n    if (!isValidProfileName(name)) {\n      throw new BrowserValidationError(\"invalid profile name\");\n    }\n\n    const state = ctx.state();\n    const cfg = getRuntimeConfig();\n    const profiles = cfg.browser?.profiles ?? {};\n    const defaultProfile = cfg.browser?.defaultProfile ?? state.resolved.defaultProfile;\n    if (name === defaultProfile) {\n      throw new BrowserValidationError(\n        `cannot delete the default profile \"${name}\"; change browser.defaultProfile first`,\n      );\n    }\n    const runtimeProfile = getOwnBrowserProfile(profiles, name);\n    if (!runtimeProfile) {\n      throw new BrowserProfileNotFoundError(`profile \"${name}\" not found`);\n    }\n    const sourceProfile = getOwnBrowserProfile(\n      getRuntimeConfigSourceSnapshot()?.browser?.profiles,\n      name,\n    );\n    const expected = structuredClone(sourceProfile ?? runtimeProfile);\n\n    let deleted = false;\n    const configuredProfile = resolveProfile(resolveBrowserConfig(cfg.browser, cfg), name);\n    const resolved = configuredProfile ?? state.profiles.get(name)?.profile;\n    const runtime = resolved ? getOrCreateProfileRuntime(state, resolved) : undefined;\n\n    const persistDelete = async () => {\n      await deleteBrowserProfileConfig({ name, expected });\n      delete state.resolved.profiles[name];\n      try {\n        if (resolved?.cdpIsLoopback && resolved.driver === \"openclaw\" && !resolved.attachOnly) {\n          const userDataDir = resolveOpenClawUserDataDir(name);","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser/profiles-service.ts#L226-L262","documentation":"A BrowserProfileNotFoundError (HTTP 404) thrown by deleteProfile when getOwnBrowserProfile(cfg.browser?.profiles ?? {}, name) returns falsy — i.e. the profile key is not present in the runtime config's browser.profiles map. This runs after the default-profile guard, so it only fires for non-default names that are absent from config.","triggerScenarios":"Calling deleteProfile on a name that passes the format check, is not the default, but is not in cfg.browser.profiles — e.g. a stale id from a previous session, a typo, or a profile that was already deleted by another caller.","commonSituations":"UI showed a cached profile list that is now stale; concurrent deletion by another session; user typed a plausible-looking name that was never created; profile existed in resolved runtime state but not in source config (config-only delete path).","solutions":["Refresh the profile list with listProfiles() and pass a name that is currently present.","If the profile appears in the UI but not in config, run `openclaw doctor --fix` to reconcile, then retry.","Treat the 404 as success if the goal is simply 'ensure it is gone' (idempotent delete)."],"exampleFix":"// before\nawait deleteProfile(requestedName);\n// after\nconst names = (await listProfiles()).map(p => p.name);\nif (!names.includes(requestedName)) return { ok: true, profile: requestedName, deleted: false };\nawait deleteProfile(requestedName);","handlingStrategy":"type-guard","validationCode":"const live = await listProfiles();\nconst exists = live.some(p => p.name === name);\nif (!exists) return { ok: true, profile: name, deleted: false }; // idempotent\nawait deleteProfile(name);","typeGuard":"async function profileExists(name: string): Promise<boolean> {\n  return (await listProfiles()).some(p => p.name === name);\n}","tryCatchPattern":"try {\n  await deleteProfile(name);\n} catch (e) {\n  if (e instanceof BrowserProfileNotFoundError) {\n    return { ok: true, profile: name, deleted: false }; // already gone\n  }\n  throw e;\n}","preventionTips":["Refresh the profile list before showing delete actions.","Treat 404 on delete as success when the goal is idempotent removal.","Run `openclaw doctor --fix` to reconcile resolved-state vs config drift."],"tags":["browser","profile","not-found","config","idempotency"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}