Diagnose OpenCode startup, server, and session issues.
You can ask OpenCode to debug itself. Describe the problem and ask it to use this troubleshooting page; it can read
the steps below, inspect its service and logs, and help identify the issue.
OpenCode runs as two processes: the TUI is a client, while a background server owns sessions, plugins, permissions, and
other application state. Start by determining whether an issue is in the client, the shared server, or a specific project.
Check the background service
Show the current server status:
opencode2 service status
Verify that its API is healthy:
opencode2 api get /api/health
If the service is stuck or unhealthy, restart it:
opencode2 service restart
From inside the TUI, run /restart to restart the managed service and reconnect:
/restart
You can also stop and start it explicitly:
opencode2 service stopopencode2 service start
OpenCode normally discovers or starts the shared background service automatically. The service commands are only
needed when diagnosing its lifecycle.
Run an isolated session
Use standalone mode to run the TUI with a private server that exits with it:
opencode2 --standalone
If an issue disappears in standalone mode, it is likely related to the shared background service rather than the TUI or
project itself.
Inspect the API
The api command uses the same discovery and authentication flow as the TUI. It accepts either an HTTP method and path or
an OpenAPI operation ID.See the API reference for all endpoints and operation IDs.Pass a JSON request body with --data or -d, and add headers with --header or -H.
Running opencode2 api may start the background service when no compatible healthy service is available.
Read logs
Installed builds write logs to:
~/.local/share/opencode/log/opencode.log
Follow the log while reproducing the problem:
tail -f ~/.local/share/opencode/log/opencode.log
Each line includes a process run ID and a role field. Use role=cli for TUI and command startup, and role=server for
session, provider, plugin, permission, and tool activity.
Its private service configuration is stored separately at:
~/.config/opencode/service.json
The database normally lives at:
~/.local/share/opencode/opencode-next.db
OPENCODE_DB can override the database location.
Do not delete or edit service files or the database while troubleshooting. Use the service commands to manage the
daemon, and make a backup before inspecting persistent data with external tools.
Explicit servers
When connecting with --server, set OPENCODE_PASSWORD if the server requires authentication:
Use the same diagnostics through the package development command:
bun dev service statusbun dev service restartbun dev api get /api/health
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"OpenCode","description":"OpenCode documentation.","colors":{"primary":"#3B7DD8","light":"#3B7DD8","dark":"#FAB283"},"logo":{"light":"https://mintcdn.com/opencode/I9imL3yakeNOmSz3/assets/logo-light.svg?fit=max\u0026auto=format\u0026n=I9imL3yakeNOmSz3\u0026q=85\u0026s=b9a88d865bfc9b7d05f0c13811d25155","dark":"https://mintcdn.com/opencode/I9imL3yakeNOmSz3/assets/logo-dark.svg?fit=max\u0026auto=format\u0026n=I9imL3yakeNOmSz3\u0026q=85\u0026s=124e9dfcb5ab39a7939b193fdf49c539"},"favicon":"https://mintcdn.com/opencode/I9imL3yakeNOmSz3/assets/favicon.svg?fit=max\u0026auto=format\u0026n=I9imL3yakeNOmSz3\u0026q=85\u0026s=bb6c2a0e1484df478a0008cfe3c08a93","footer":{"socials":{"github":"https://github.com/anomalyco/opencode","x":"https://x.com/opencode"}},"contextual":{"options":["copy","view","chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"opencode","hasAudioNarration":false,"actualSubdomain":"opencode","customDomains":["v2.opencode.ai"],"gitSource":{"type":"github","owner":"anomalyco","repo":"opencode","deployBranch":"v2","contentDirectory":"packages/docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae95babcb76ddd761cc5b18:success","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"API","count":99},{"language":"default","tag":"Endpoints","count":98},{"language":"default","tag":"session","count":29},{"language":"default","tag":"Docs","count":21},{"language":"default","tag":"Configure","count":17},{"language":"default","tag":"form","count":7},{"language":"default","tag":"integration","count":7},{"language":"default","tag":"permission","count":7},{"language":"default","tag":"pty","count":7},{"language":"default","tag":"shell","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"troubleshooting","slug":"/troubleshooting","pageMetadata":{"title":"Troubleshooting","description":"Diagnose OpenCode startup, server, and session issues.","href":"/troubleshooting"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Diagnose OpenCode startup, server, and session issues.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Tip,{children:_jsx(_components.p,{children:`You can ask OpenCode to debug itself. Describe the problem and ask it to use this troubleshooting page; it can read\nthe steps below, inspect its service and logs, and help identify the issue.`})}),`\n`,_jsx(_components.p,{children:`OpenCode runs as two processes: the TUI is a client, while a background server owns sessions, plugins, permissions, and\nother application state. Start by determining whether an issue is in the client, the shared server, or a specific project.`}),`\n`,_jsx(Heading,{level:`2`,id:`check-the-background-service`,children:`Check the background service`}),`\n`,_jsx(_components.p,{children:`Show the current server status:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Verify that its API is healthy:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` api`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` get`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /api/health`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`If the service is stuck or unhealthy, restart it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` restart`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`From inside the TUI, run `,_jsx(_components.code,{children:`/restart`}),` to restart the managed service and reconnect:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`/restart`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`You can also stop and start it explicitly:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` stop`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` start`})]}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsx(_components.p,{children:`OpenCode normally discovers or starts the shared background service automatically. The service commands are only\nneeded when diagnosing its lifecycle.`})}),`\n`,_jsx(Heading,{level:`2`,id:`run-an-isolated-session`,children:`Run an isolated session`}),`\n`,_jsx(_components.p,{children:`Use standalone mode to run the TUI with a private server that exits with it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`opencode2`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --standalone`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`If an issue disappears in standalone mode, it is likely related to the shared background service rather than the TUI or\nproject itself.`}),`\n`,_jsx(Heading,{level:`2`,id:`inspect-the-api`,children:`Inspect the API`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`api`}),` command uses the same discovery and authentication flow as the TUI. It accepts either an HTTP method and path or\nan OpenAPI operation ID.`]}),`\n`,_jsxs(_components.p,{children:[`See the `,_jsx(_components.a,{href:`/api`,children:`API reference`}),` for all endpoints and operation IDs.`]}),`\n`,_jsxs(_components.p,{children:[`Pass a JSON request body with `,_jsx(_components.code,{children:`--data`}),` or `,_jsx(_components.code,{children:`-d`}),`, and add headers with `,_jsx(_components.code,{children:`--header`}),` or `,_jsx(_components.code,{children:`-H`}),`.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Running `,_jsx(_components.code,{children:`opencode2 api`}),` may start the background service when no compatible healthy service is available.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`read-logs`,children:`Read logs`}),`\n`,_jsx(_components.p,{children:`Installed builds write logs to:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/share/opencode/log/opencode.log`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Follow the log while reproducing the problem:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`tail`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ~/.local/share/opencode/log/opencode.log`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Each line includes a process `,_jsx(_components.code,{children:`run`}),` ID and a `,_jsx(_components.code,{children:`role`}),` field. Use `,_jsx(_components.code,{children:`role=cli`}),` for TUI and command startup, and `,_jsx(_components.code,{children:`role=server`}),` for\nsession, provider, plugin, permission, and tool activity.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`grep`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'role=cli'`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ~/.local/share/opencode/log/opencode.log`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`grep`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'role=server'`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ~/.local/share/opencode/log/opencode.log`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`grep`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'run=8fc3b1d5'`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ~/.local/share/opencode/log/opencode.log`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Increase verbosity for one reproduction:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OPENCODE_LOG_LEVEL`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`DEBUG`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` opencode2`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`service-files`,children:`Service files`}),`\n`,_jsx(_components.p,{children:`The shared server registers itself at:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/state/opencode/service.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Its private service configuration is stored separately at:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.config/opencode/service.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The database normally lives at:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/share/opencode/opencode-next.db`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`OPENCODE_DB`}),` can override the database location.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Do not delete or edit service files or the database while troubleshooting. Use the service commands to manage the\ndaemon, and make a backup before inspecting persistent data with external tools.`})}),`\n`,_jsx(Heading,{level:`2`,id:`explicit-servers`,children:`Explicit servers`}),`\n`,_jsxs(_components.p,{children:[`When connecting with `,_jsx(_components.code,{children:`--server`}),`, set `,_jsx(_components.code,{children:`OPENCODE_PASSWORD`}),` if the server requires authentication:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`OPENCODE_PASSWORD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`secret`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` opencode2`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --server`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:4096`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The CLI checks the server before opening the TUI and reports whether it is unreachable, requires a password, or rejected\nthe supplied password.`}),`\n`,_jsx(Heading,{level:`2`,id:`report-an-issue`,children:`Report an issue`}),`\n`,_jsx(_components.p,{children:`Include the following when reporting a reproducible problem:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Output from `,_jsx(_components.code,{children:`opencode2 --version`})]}),`\n`,_jsxs(_components.li,{children:[`Output from `,_jsx(_components.code,{children:`opencode2 service status`})]}),`\n`,_jsx(_components.li,{children:`The smallest sequence of steps that reproduces the issue`}),`\n`,_jsxs(_components.li,{children:[`Whether the issue also occurs with `,_jsx(_components.code,{children:`opencode2 --standalone`})]}),`\n`,_jsxs(_components.li,{children:[`Relevant log lines, including their `,_jsx(_components.code,{children:`run`}),` and `,_jsx(_components.code,{children:`role`}),` fields`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Remove API keys, authorization headers, prompts, file contents, and other sensitive data before sharing logs.`}),`\n`,_jsx(Heading,{level:`2`,id:`local-development`,children:`Local development`}),`\n`,_jsx(_components.p,{children:`When working from the OpenCode repository, run V2 commands from the repository root:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The local development channel keeps its logs, SQLite database, and service registration separate from installed builds:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/share/opencode/log/opencode-local.log`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/share/opencode/opencode-local.db`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`~/.local/state/opencode/service-local.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Use the same diagnostics through the package development command:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` status`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` service`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` restart`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dev`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` api`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` get`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /api/health`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Troubleshooting","description":"Diagnose OpenCode startup, server, and session issues.","href":"/troubleshooting"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Check the background service","slug":"check-the-background-service","depth":2,"children":[]},{"title":"Run an isolated session","slug":"run-an-isolated-session","depth":2,"children":[]},{"title":"Inspect the API","slug":"inspect-the-api","depth":2,"children":[]},{"title":"Read logs","slug":"read-logs","depth":2,"children":[]},{"title":"Service files","slug":"service-files","depth":2,"children":[]},{"title":"Explicit servers","slug":"explicit-servers","depth":2,"children":[]},{"title":"Report an issue","slug":"report-an-issue","depth":2,"children":[]},{"title":"Local development","slug":"local-development","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"opencode","siteName":"OpenCode","title":"Troubleshooting - OpenCode","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-15T15:48:54.408Z","originalFileLocation":"troubleshooting.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Diagnose OpenCode startup, server, and session issues.\">\u003cmeta data-mint-head name=\"application-name\" content=\"OpenCode\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Troubleshooting - OpenCode\">\u003cmeta data-mint-head property=\"og:description\" content=\"Diagnose OpenCode startup, server, and session issues.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"OpenCode\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://v2.opencode.ai/troubleshooting\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://opencode.mintlify.site/_mintlify/api/og/v2?division=Get+started\u0026amp;title=Troubleshooting\u0026amp;description=Diagnose+OpenCode+startup%2C+server%2C+and+session+issues.\u0026amp;theme=b508c82d59db3c1fe3b4b82a\u0026amp;signature=554b0a3a4f4a4d302b6c60fe3238df6f2373d81817fa07801ddd46e61e0099e6\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Troubleshooting - OpenCode\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Diagnose OpenCode startup, server, and session issues.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://opencode.mintlify.site/_mintlify/api/og/v2?division=Get+started\u0026amp;title=Troubleshooting\u0026amp;description=Diagnose+OpenCode+startup%2C+server%2C+and+session+issues.\u0026amp;theme=b508c82d59db3c1fe3b4b82a\u0026amp;signature=554b0a3a4f4a4d302b6c60fe3238df6f2373d81817fa07801ddd46e61e0099e6\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/opencode/lT2Av3JhNg3JX7JA/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"OpenCode\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3B7DD8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://v2.opencode.ai/troubleshooting\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/troubleshooting.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://v2.opencode.ai/#organization\",\"name\":\"OpenCode\",\"url\":\"https://v2.opencode.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/opencode/I9imL3yakeNOmSz3/assets/logo-light.svg?fit=max\u0026auto=format\u0026n=I9imL3yakeNOmSz3\u0026q=85\u0026s=b9a88d865bfc9b7d05f0c13811d25155\"}},{\"@type\":\"WebSite\",\"@id\":\"https://v2.opencode.ai#website\",\"name\":\"OpenCode\",\"url\":\"https://v2.opencode.ai\",\"publisher\":{\"@id\":\"https://v2.opencode.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://v2.opencode.ai/troubleshooting#webpage\",\"url\":\"https://v2.opencode.ai/troubleshooting\",\"name\":\"Troubleshooting\",\"description\":\"Diagnose OpenCode startup, server, and session issues.\",\"dateModified\":\"2026-07-15T15:48:54.408Z\",\"isPartOf\":{\"@id\":\"https://v2.opencode.ai#website\"},\"breadcrumb\":{\"@id\":\"https://v2.opencode.ai/troubleshooting#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://v2.opencode.ai/troubleshooting#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get started\",\"item\":\"https://v2.opencode.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Troubleshooting\",\"item\":\"https://v2.opencode.ai/troubleshooting\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://v2.opencode.ai/troubleshooting#article\",\"headline\":\"Troubleshooting\",\"name\":\"Troubleshooting\",\"description\":\"Diagnose OpenCode startup, server, and session issues.\",\"url\":\"https://v2.opencode.ai/troubleshooting\",\"mainEntityOfPage\":{\"@id\":\"https://v2.opencode.ai/troubleshooting#webpage\"},\"dateModified\":\"2026-07-15T15:48:54.408Z\",\"publisher\":{\"@id\":\"https://v2.opencode.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://v2.opencode.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"OpenCode\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"OpenCode\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/troubleshooting.md","siteName":"OpenCode","nav":{"global":{},"tabs":[{"tab":"Docs","groups":[{"group":"Get started","pages":[{"title":"Intro","href":""},{"title":"Migrate from V1","href":"/migrate-v1"},{"title":"Config","description":null,"href":"/config"},{"title":"Troubleshooting","href":"/troubleshooting"}]},{"group":"Configure","pages":[{"title":"Providers","description":null,"href":"/providers"},{"title":"Models","href":"/models"},{"title":"Agents","href":"/agents"},{"title":"Permissions","href":"/permissions"},{"title":"Session sharing","href":"/sharing"},{"title":"Undo","href":"/snapshots"},{"title":"Commands","href":"/commands"},{"title":"Skills","href":"/skills"},{"title":"Instructions","href":"/instructions"},{"title":"MCP servers","href":"/mcp-servers"},{"title":"Attachments","href":"/attachments"},{"title":"Compaction","href":"/compaction"},{"title":"Session warming","href":"/warming"},{"title":"Themes","href":"/themes"},{"title":"Formatters","href":"/formatters"},{"title":"LSP","href":"/lsp"},{"title":"References","href":"/references"}]}]},{"tab":"Build","pages":[{"title":"Build","href":"/build"}]},{"tab":"API","pages":[{"title":"API","href":"/api"}]}]},"basePath":"","title":"Troubleshooting - OpenCode","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}