{"record":{"id":"ffbb8dd7fa96fc3b","repo":"jlcodes99/cockpit-tools","slug":"not-available-ffbb8d","errorCode":"not_available","errorMessage":"${skipped?.reason} || not_available","messagePattern":"(.+?) \\|\\| not_available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/CodexSwitchProgressModal.tsx","lineNumber":473,"sourceCode":"      retrySwitchAfterOAuth: true,\n      retrySwitchLaunchAfterSwitch: state.launchAfterSwitch,\n    });\n  };\n\n  const handleUseForApiService = async () => {\n    if (!authFailure?.apiOnlyAvailable || actionBusy) return;\n    setActionBusy(\"api\");\n    setActionError(null);\n    try {\n      const result =\n        await codexLocalAccessService.appendCodexLocalAccessAccounts([\n          state.accountId,\n        ]);\n      if (!result.syncedAccountIds.includes(state.accountId)) {\n        const skipped = result.skippedAccounts.find(\n          (item) => item.accountId === state.accountId,\n        );\n        throw new Error(skipped?.reason || \"not_available\");\n      }\n      setState(null);\n      window.dispatchEvent(\n        new CustomEvent(\"app-request-navigate\", {\n          detail: \"codex-api-service\",\n        }),\n      );\n    } catch (error) {\n      setActionError(\n        t(\"codex.switchAuth.apiServiceAddFailed\", {\n          error: String(error).replace(/^Error:\\s*/, \"\"),\n        }),\n      );\n    } finally {\n      setActionBusy(null);\n    }\n  };\n","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/components/CodexSwitchProgressModal.tsx#L455-L491","documentation":"Guard in CodexSwitchProgressModal.handleUseForApiService: appendCodexLocalAccessAccounts did not include state.accountId in syncedAccountIds, so the account was skipped by the backend. The skipped record's reason becomes the thrown error message, falling back to 'not_available'; the 'use for API service' action is reported as failed.","triggerScenarios":"Thrown at src/components/CodexSwitchProgressModal.tsx:473 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the skip reason returned for the account and address it (invalid tokens, duplicate, disabled)","Retry the API-service action once the account passes backend validation","Keep the switch modal state consistent by refreshing local access state after the failure"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}