Skip to content

Codex CLI fails on deployed app: "Error loading configuration: No such file or directory" #24

@dgokeeffe

Description

@dgokeeffe

Symptom

Running codex inside the deployed CODA app's terminal returns:

Error loading configuration: No such file or directory (os error 2)

Diagnosis

Confirmed empirically via the deployed app's terminal:

$ ls -la ~/.codex/
-rw------- 1 app app  114 May  6 08:42 .env
-rw-r--r-- 1 app app    3 May  6 05:56 .personality_migration
-rw-r--r-- 1 app app 3678 May  6 05:53 AGENTS.md
-rw-r--r-- 1 app app  535 May  6 05:53 config.toml
drwxr-xr-x 2 app app 4096 May  6 05:56 memories
drwxr-xr-x 3 app app 4096 May  6 05:56 tmp
$ [ -f ~/.codex/databricks-models.json ] && echo OK || echo MISSING
MISSING

config.toml references model_catalog_json = "databricks-models.json". Codex resolves that relative to CODEX_HOME (~/.codex), tries to open ~/.codex/databricks-models.json, fails — hence the error.

The deploy doesn't have it because databricks sync skipped it. The .codex/ directory doesn't appear in the synced workspace at all:

$ databricks workspace list /Workspace/Users/<owner>/apps/coding-agents/.codex/ -p daveok
Error: Path doesn't exist.

Root cause

.gitignore has:

.codex/*
!.codex/databricks-models.json

Git honors the negation — .codex/databricks-models.json is tracked. databricks sync (which respects .gitignore to decide what to upload) appears to honor the blanket-ignore but not the negation pattern, so it skips the catalog along with everything else. Net effect: file is in your local repo, in the GitHub repo, and in git ls-tree, but never makes it to the deployed app's filesystem.

setup_codex.py:100's guard then short-circuits silently:

if catalog_src.exists() and catalog_src.resolve() != catalog_dst.resolve():
    shutil.copyfile(catalog_src, catalog_dst)

Since catalog_src doesn't exist on the synced machine, the copy is skipped, no warning, no error — ~/.codex/ ends up without the catalog.

Fix (PR coming)

Replace the .codex/* + !X negation pattern in .gitignore with explicit per-file/dir ignores:

.codex/config.toml
.codex/.env
.codex/AGENTS.md
.codex/.personality_migration
.codex/memories/
.codex/tmp/
.codex/sessions/
.codex/cron/
.codex/skills/

Same runtime artifacts ignored. databricks-models.json is no longer touched by any pattern → both git and databricks sync track it.

This is a general antipattern lesson: gitignore negations work in git but several gitignore-honoring tools skip them. Better to enumerate ignores explicitly than rely on * + !.

Out of scope

  • setup_codex.py could also defensively log a warning when catalog_src doesn't exist (it currently passes silently). Worth a follow-up but not required for the fix to land.
  • Same antipattern probably exists in other .gitignore-honoring tools we use (Docker, etc.). Not auditing here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions