chatgpt-codex-repair

Used to repair the OpenAI ChatGPT/Codex Windows desktop app (MSIX package name "OpenAI.Codex") when it gets stuck on "Windows installation did not finish" or reports errors like "failed to create chat" / "could not resolve feature override priority." Apply when the client won't start, is stuck on the installer, or cannot create chats; the root cause is almost always a corrupted or missing %USERPROFILE%\.codex\config.toml file (not a WSL/Windows sandbox issue).

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "chatgpt-codex-repair" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c7723be6c652845e3cd07ff241d82f29ba7ad19195ded68c825cd022e3938115. Verify the upstream source and version against https://skillhub.cn/skills/user_f7f866dd/chatgpt-windows-setup-fix before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Used to repair the OpenAI ChatGPT/Codex Windows desktop app (MSIX package name "OpenAI.Codex") when it gets stuck on "Windows installation did not finish" or reports errors like "failed to create chat" / "could not resolve feature override priority." Apply when the client won't start, is stuck on the installer, or cannot create chats; the root cause is almost always a corrupted or missing %USERPROFILE%\.codex\config.toml file (not a WSL/Windows sandbox issue).

0 Downloads

Introduction source: third_party · user_f7f866dd · 1.0.0 Reference

SkillPi interpretation

Tasks
The OpenAI ChatGPT desktop app on Windows ships as an MSIX package named `OpenAI.Codex` (not "ChatGPT" — search packages with `*Codex*`). Its two most common fatal symptoms are:
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Open the config and look for: `elevated` requires a one-time admin install (creates a sandbox user, firewall rules, local policy). When that install fails on the user's machine, the app hangs forever on setup. Fix:** change it to the official fallback (no admin install needed): Never delete the whole file — it usually holds the user's model/API settings. Edit only the offending line. Back up the file first (see Step 3).
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: chatgpt-codex-repair
description: This skill repairs the OpenAI ChatGPT / Codex desktop app (Windows, MSIX package "OpenAI.Codex") when it is stuck on "Windows setup didn't finish" or fails with "Error creating chat" / "failed to resolve feature override precedence". Use it whenever a user reports the ChatGPT/Codex desktop client failing to start, hanging on setup, or being unable to create a chat. The root cause is almost always a corrupted or missing `%USERPROFILE%\.codex\config.toml` (NOT a WSL / Windows Sandbox system problem, despite common misdiagnosis).
agent_created: true

ChatGPT / Codex Desktop Repair

Overview

The OpenAI ChatGPT desktop app on Windows ships as an MSIX package named OpenAI.Codex (not "ChatGPT" — search packages with *Codex*). Its two most common fatal symptoms are:

  1. "Windows setup didn't finish" — agent sandbox initialization hangs.
  2. "Error creating chat" / failed to resolve feature override precedence: 系统找不到指定的文件 (os error 2) — config read crashes on startup.

Both are caused by a bad ~/.codex/config.toml (or a file it references). The app stores its real config OUTSIDE the MSIX package, so uninstalling / reinstalling / Reset-AppxPackage does NOT clear it — the broken state is reused every time. WSL and Windows Sandbox are red herrings; the desktop client does not require them.

Recurrence — auto-update silently re-breaks it (read this first)

This is the single most token-wasting trap: ChatGPT/Codex auto-updates in the background, and an update silently resets [windows] sandbox back to "elevated" (and can revert the catalog path). So the exact same "Windows setup didn't finish" symptom recurs after every update. It is NOT a new problem and NOT caused by disk cleanup, Dism++, Windows 磁盘清理, or anything the user did — just re-apply the fix.

When the symptom returns:

  1. Re-apply Step 1 (sandbox = "unelevated") and, if needed, Step 2.
  2. Or just run the bundled one-click repair — see Quick fix below. It is idempotent.
  3. Reopen ChatGPT. No need to re-diagnose from scratch.

Workflow Decision Tree

User reports ChatGPT/Codex broken
  │
  ├─ Symptom A: "Windows setup didn't finish"
  │     └─ See Step 1 (fix [windows] sandbox)
  │
  └─ Symptom B: "Error creating chat" / feature override precedence / os error 2
        └─ See Step 2 (fix model_catalog_json / referenced files)

Both symptoms can co-occur. Apply Step 1 first, then Step 2 if needed.

Step 0 — Locate and read the config (read-only)

The config lives at C:\Users\<user>\.codex\config.toml. Confirm it exists and read it.

Useful companion locations:

  • App package dir: C:\Program Files\WindowsApps\OpenAI.Codex_*\
  • Logs (newest first): C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_*\LocalCache\Local\Codex\Logs\
  • Real (non-virtualized) data: C:\Users\<user>\AppData\Local\OpenAI\Codex\

To read the latest log and catch the real error:

$pkg=(Get-AppxPackage -Name *Codex* | Select-Object -First 1).PackageFamilyName
$logdir="$env:LOCALAPPDATA\Packages\$pkg\LocalCache\Local\Codex\Logs"
Get-ChildItem -Path $logdir -Recurse -Filter *.log | Sort-Object LastWriteTime -Descending |
  Select-Object -First 3 | ForEach-Object {
    Get-Content $_.FullName | Where-Object { $_ -match 'os error|feature override|Windows setup|Error creating|failed to' }
  }

The package folder name suffix varies by version — list with Get-AppxPackage -Name *Codex* to get the exact PackageFullName.

Step 0b — If a third-party proxy manager (CC Switch, etc.) is in use

Some users route Codex through a local proxy (e.g. CC Switch runs cc-switch.exe and listens on http://127.0.0.1:15721/v1). In that case the config is owned by that tool, not by you:

[model_providers.custom]
name = "deepseek"
base_url = "http://127.0.0.1:15721/v1"      # local proxy, NOT the provider URL
wire_api = "responses"
experimental_bearer_token = "PROXY_MANAGED"  # proxy injects the real key

Recognize it by: base_url points to 127.0.0.1/localhost, and/or experimental_bearer_token = "PROXY_MANAGED".

Do NOT manually rewrite base_url / wire_api / the catalog slug — the proxy manager will overwrite your edits the next time it runs and re-point at the provider directly (e.g. https://api.deepseek.com/...), which then 404s because the provider may not support the Responses API path the app appends.

Correct procedure when a proxy manager is involved:

  1. Confirm the manager process is running (e.g. Get-Process -Name cc-switch) and its port is listening: Test-NetConnection 127.0.0.1 -Port 15721.
  2. Verify end-to-end through the proxy (not the provider) with a quick request:
    import urllib.request, json
    req = urllib.request.Request(
        "http://127.0.0.1:15721/v1/responses",
        data=json.dumps({"model":"deepseek-v4-flash","input":"hi"}).encode(),
        headers={"Authorization":"Bearer PROXY_MANAGED","Content-Type":"application/json"},
        method="POST")
    print(urllib.request.urlopen(req, timeout=25).status)  # expect 200

    If this returns 200, the proxy + key injection work; a 404 here means the manager's key/upstream is misconfigured (fix in the manager UI, not config.toml).

  3. Make sure the manager re-wrote config.toml to the proxy form, then just restart ChatGPT so it re-reads the config. That alone clears the stale direct-to-provider 404.
  4. Tell the user: keep the proxy manager running — closing it kills the local endpoint and ChatGPT can no longer send requests.

Step 1 — Fix "Windows setup didn't finish" (sandbox)

Open the config and look for:

[windows]
sandbox = "elevated"

elevated requires a one-time admin install (creates a sandbox user, firewall rules, local policy). When that install fails on the user's machine, the app hangs forever on setup.

Fix: change it to the official fallback (no admin install needed):

[windows]
sandbox = "unelevated"

Never delete the whole file — it usually holds the user's model/API settings. Edit only the offending line. Back up the file first (see Step 3).

Step 2 — Fix "Error creating chat" (missing referenced file)

The error failed to resolve feature override precedence: 系统找不到指定的文件 (os error 2) means the config references a file that does not exist, so the entire config read aborts and cascades into failed to reload config, experimentalFeature/list, plugin/list, etc.

Most often the culprit is:

model_catalog_json = "cc-switch-model-catalog.json"   # relative path — file missing!

model_catalog_json points to a custom model-catalog JSON. If the file is missing (CC Switch or similar tool failed to generate it, or it was lost on reinstall), every config read fails.

Fix (two parts):

  1. Create the missing file with a valid catalog (see assets/model-catalog-template.json). The slug MUST match the model = "..." value in config.toml.
  2. Change the path to an absolute path (relative paths / ~ are known to break):
    model_catalog_json = "C:\\Users\\<user>\\.codex\\cc-switch-model-catalog.json"

The model_catalog_json schema is strict — missing fields like slug, display_name, base_instructions, supports_reasoning_summaries, supported_reasoning_levels, shell_type, visibility will throw "missing field X" on next load. Use the template.

If a different referenced path is missing (e.g. a [marketplaces.*] source), apply the same logic: create the file / fix the path, prefer absolute paths.

Quick fix — one-click repair (recommended)

Copy the idempotent repair script below into a *.ps1 file on Windows and run it from PowerShell (powershell -ExecutionPolicy Bypass -File .\repair.ps1). It does Steps 1–3 automatically:

  1. Backs up config.toml (timestamped, never overwrites old backups).
  2. Rewrites sandbox = "elevated" → "unelevated".
  3. Rewrites a relative model_catalog_json to its absolute path.
  4. Kills stuck ChatGPT/Codex processes so the app can be reopened cleanly.

Run it whenever the symptom appears (including right after an auto-update). Safe to run even when the config is already correct — it skips changes it does not need to make.

$ErrorActionPreference = 'Stop'

$configPath = "$env:USERPROFILE\.codex\config.toml"
$absCatalog = "$env:USERPROFILE\.codex\cc-switch-model-catalog.json"

if (-not (Test-Path $configPath)) {
    Write-Host "config.toml not found: $configPath" -ForegroundColor Red
    exit 1
}

# Backup current config (timestamped, never overwrites old backups)
$timestamp = Get-Date -Format 'yyyyMMddHHmmss'
$bak = "$configPath.bak-$timestamp"
Copy-Item $configPath $bak -Force
Write-Host "Backed up config to: $bak"

$content = Get-Content $configPath -Raw
$changed = $false

# 1) Fix [windows] sandbox = "elevated" -> "unelevated"
if ($content -match 'sandbox\s*=\s*"elevated"') {
    $content = $content -replace 'sandbox\s*=\s*"elevated"', 'sandbox = "unelevated"'
    Write-Host "Fixed: [windows] sandbox set to unelevated" -ForegroundColor Green
    $changed = $true
} else {
    Write-Host "OK: [windows] sandbox already not elevated, skipped"
}

# 2) Fix relative model_catalog_json to absolute path
if ($content -match 'model_catalog_json\s*=\s*"cc-switch-model-catalog\.json"') {
    $content = $content -replace 'model_catalog_json\s*=\s*"cc-switch-model-catalog\.json"', "model_catalog_json = `"$absCatalog`""
    Write-Host "Fixed: model_catalog_json set to absolute path" -ForegroundColor Green
    $changed = $true
} else {
    Write-Host "OK: model_catalog_json already absolute or not present, skipped"
}

if ($changed) {
    Set-Content $configPath $content -Encoding ASCII -NoNewline
    Write-Host "config.toml updated." -ForegroundColor Green
} else {
    Write-Host "No changes needed in config.toml."
}

# 3) Kill stuck ChatGPT / Codex processes
$procs = Get-Process | Where-Object { $_.Name -match 'codex|chatgpt' }
if ($procs) {
    $procs | ForEach-Object { Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue }
    Write-Host "Killed $($procs.Count) stuck ChatGPT/Codex process(es). Please reopen ChatGPT." -ForegroundColor Yellow
} else {
    Write-Host "No running ChatGPT/Codex process found."
}

Write-Host ""
Write-Host "Done. If ChatGPT still shows the error after reopening, make sure CC Switch is running (cc-switch.exe)."

Step 3 — Apply changes safely

  1. Kill stuck processes: Get-Process -Name ChatGPT, codex | Stop-Process -Force
  2. Back up config: Copy-Item $env:USERPROFILE\.codex\config.toml $env:USERPROFILE\.codex\config.toml.bak-$(Get-Date -Format yyyyMMddHHmmss)
  3. Edit config.toml (Edit tool) — change only the offending lines.
  4. Create any missing referenced file (Write tool) using assets/model-catalog-template.json as a base, adjusting the slug to match model = "...".
  5. Relaunch the app: explorer.exe "shell:appsFolder\OpenAI.Codex_<suffix>!App"
  6. Wait ~20s, then re-read the latest log. Success looks like: method=config/read ... errorCode=null and no failed to resolve feature override precedence / Error creating chat lines.

Step 4 — Last-resort fallback

If editing still fails, rename (do NOT delete) the config so the app regenerates a clean default:

Rename-Item $env:USERPROFILE\.codex\config.toml $env:USERPROFILE\.codex\config.toml.old

Relaunch → app generates fresh default config and should open. Then copy the user's custom model provider block (e.g. the [model_providers.custom] DeepSeek section) from config.toml.old back into the new file — but never copy back a broken sandbox = "elevated" line.

Notes / gotchas

  • The desktop client does NOT need WSL or Windows Sandbox. Do not send users down the wsl --install path for these symptoms.
  • Windows Sandbox is unavailable on Windows Home edition — another reason elevated sandbox setup fails there.
  • model_catalog_json requires an absolute path; relative paths silently fail.
  • A single fs/readFile ... os error 3 (path not found) with no cascade is usually benign.
  • User-level API keys set inside the app (e.g. a DeepSeek key) live in this config and are cleared by Reset-AppxPackage — confirm with the user after a reset.
  • Recurrence after auto-update: the app updates itself and resets sandbox to elevated, so the symptom returns on its own. Re-apply the fix (or run the embedded repair script from Quick fix); do not treat it as a fresh incident.
  • Disk / system cleanup does NOT cause this. Tools like Dism++, Windows 磁盘清理, and Dism /Online /Cleanup-Image clean update caches and WinSxS — they never touch ~/.codex/config.toml. If the symptom shows up "right after cleanup", it is coincidence (an update reset fired around the same time), not causation. Keep the pagefile / cleanup changes the user made; they are unrelated.

Resources

  • assets/model-catalog-template.json — ready-to-use model catalog; set slug to match model = "..." in config.toml.
  • references/model_catalog_schema.md — full field reference for model_catalog_json.
  • The one-click repair script is embedded inline in Quick fix above (copy into a *.ps1 file and run with powershell -ExecutionPolicy Bypass -File .\repair.ps1).

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 针对 Windows 用户在使用 OpenAI ChatGPT/Codex 桌面客户端时常见的高频故障(启动失败、安装卡住、创建聊天报错)提供精准修复方案
  • 包含自动化 PowerShell 修复脚本,支持一键修复,显著提升问题解决效率
Trigger Precision95/100

Highlights

  • 触发词覆盖全面,明确列出典型错误信息、系统环境和核心症状,边界清晰,不易误触或漏触
Structure and Standards85/100

Areas to improve

  • 引用文件缺失 Reported severity: Minor

    SKILL.md 中引用了 assets/model-catalog-template.json 和 references/model_catalog_schema.md,但未在传入内容中提供

    Recommendation: 请补充被引用的资源文件,或明确说明其为外部资源并提供获取方式

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 中 description 字段为空,实质描述内容位于 skill_body 内部

    Recommendation: 将核心描述内容移至顶层 frontmatter 的 description 字段,保持规范一致性

Highlights

  • 文档结构完整,包含决策树、分步修复流程、自动化脚本、注意事项和最后手段,逻辑清晰,易于执行
Execution Reliability88/100

Highlights

  • 修复流程安全可靠,强调备份优先、精准修改、进程清理,并提供最后手段(重命名配置)避免数据丢失
  • 自动化脚本包含路径检查、备份机制、变更检测和进程管理,具备良好的异常处理能力
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • 127.0.0.1
  • api.deepseek.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Open the config and look for: `elevated` requires a one-time admin install (creates a sandbox user, firewall rules, local policy). When that install fails on the user's machine, the app hangs forever on setup. Fix:** change it to the official fallback (no admin install needed): Never delete the whole file — it usually holds the user's model/API settings. Edit only the offending line. Back up the file first (see Step 3).

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.