ollama - ✅(Solved) Fix ollama launch codex - ⚠ Model metadata for `gpt-oss:20b` not found. Defaulting to fallback metadata; this can degrade performance and cause issues. [1 pull requests, 6 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14752Fetched 2026-04-08 00:32:05
View on GitHub
Comments
6
Participants
5
Timeline
16
Reactions
3
Author
Timeline (top)
commented ×6subscribed ×5cross-referenced ×2mentioned ×2

Error Message

But not with escapes. The error "unsupported call: apply_patch" may be due to quoting issues. Let's try using triple quotes but escape newline? Let's attempt

Fix Action

Fix / Workaround

Tested on 0.17.7 and codex-cli 0.104.0.

  1. Frequent message ⚠ Model metadata for gpt-oss:20b not found. Defaulting to fallback metadata; this can degrade performance and cause issues.
  2. The requested task is frequently just stopped.
  3. The patch does not apply with errors like these:
• - Update File: path ..."]}. So we need to escape newlines. In the JSON, we need to encode newline as \n. The example from system used raw string with
    newlines? Actually the assistant earlier wrote apply_patch with plain text. Maybe the tool supports multiline string as is? In the earlier conversation,
    the assistant used apply_patch like:

{"command":["apply_patch","*** Begin Patch\\n*** Update File: path/...\\n@@ ..."]}

But not with escapes. The error "unsupported call: apply_patch" may be due to quoting issues. Let's try using triple quotes but escape newline? Let's attempt
  minimal patch.

PR fix notes

PR #12: Fix missing local model metadata in image and config resets

Description (problem / solution / changelog)

This PR fixes the Model metadata for <model> not found error when launching Codex with the local gpt-oss profile.

It follows the workaround from Ollama issue #14752 by bundling a local_models.json catalog in the image for the local models currently used here (gpt-oss:20b and gpt-oss:120b) and referencing that catalog from config.toml.

It also fixes the config lifecycle paths so the workaround survives container maintenance commands:

  • image builds now mirror local_models.json into /etc/codexctl/ alongside config.toml
  • codexctl run --reset-config restores both config.toml and local_models.json
  • codexctl upgrade --overwrite-config restores both files and recreates ~/.codex/AGENTS.md
  • README and manual test steps now cover the additional metadata file

Manual verification:

  • rebuilt the affected images
  • ran the updated TESTING.md checks for image defaults
  • verified codexctl run --reset-config restores both files
  • verified codexctl upgrade --overwrite-config restores both files

Changed files

  • DockerFile (modified, +3/-3)
  • DockerFile.swift (modified, +3/-3)
  • README.md (modified, +3/-3)
  • TESTING.md (modified, +13/-13)
  • codexctl (modified, +7/-6)
  • config.toml (modified, +1/-0)
  • local_models.json (added, +122/-0)

Code Example

- Update File: path ..."]}. So we need to escape newlines. In the JSON, we need to encode newline as \n. The example from system used raw string with
    newlines? Actually the assistant earlier wrote apply_patch with plain text. Maybe the tool supports multiline string as is? In the earlier conversation,
    the assistant used apply_patch like:

  {"command":["apply_patch","*** Begin Patch\\n*** Update File: path/...\\n@@ ..."]}

  But not with escapes. The error "unsupported call: apply_patch" may be due to quoting issues. Let's try using triple quotes but escape newline? Let's attempt
  minimal patch.

  We'll patch the section in a simpler way: replace the lines. Provide patch as a single string with newline escapes.

  We'll craft patch string manually: "*** Begin Patch\n*** Update File: bzlib.c\n@@\n-   bzf->strm.bzalloc  = NULL;\n-   bzf->strm.bzfree   = NULL;\n-
  bzf->strm.opaque   = NULL;\n+   bzf->strm.bzalloc  = NULL;\n+   bzf->strm.bzfree   = NULL;\n+   /* Preserve small flag /\n+   bzf->strm.opaque   = (void)
  (intptr_t)small;\n*** End Patch"

  Let's try.

---

• Ran apply_patch
  └ /bin/bash: line 1: apply_patch: command not found

---

$ git clone https://sourceware.org/git/bzip2.git
$ cd bzip2
$ ollama launch codex --model gpt-oss:20b
> Implement multiple concatenated streams support in `BZ2_bzread` (zlib-compatibility API).
RAW_BUFFERClick to expand / collapse

What is the issue?

Tested on 0.17.7 and codex-cli 0.104.0.

  1. Frequent message ⚠ Model metadata for gpt-oss:20b not found. Defaulting to fallback metadata; this can degrade performance and cause issues.
  2. The requested task is frequently just stopped.
  3. The patch does not apply with errors like these:
• - Update File: path ..."]}. So we need to escape newlines. In the JSON, we need to encode newline as \n. The example from system used raw string with
    newlines? Actually the assistant earlier wrote apply_patch with plain text. Maybe the tool supports multiline string as is? In the earlier conversation,
    the assistant used apply_patch like:

  {"command":["apply_patch","*** Begin Patch\\n*** Update File: path/...\\n@@ ..."]}

  But not with escapes. The error "unsupported call: apply_patch" may be due to quoting issues. Let's try using triple quotes but escape newline? Let's attempt
  minimal patch.

  We'll patch the section in a simpler way: replace the lines. Provide patch as a single string with newline escapes.

  We'll craft patch string manually: "*** Begin Patch\n*** Update File: bzlib.c\n@@\n-   bzf->strm.bzalloc  = NULL;\n-   bzf->strm.bzfree   = NULL;\n-
  bzf->strm.opaque   = NULL;\n+   bzf->strm.bzalloc  = NULL;\n+   bzf->strm.bzfree   = NULL;\n+   /* Preserve small flag /\n+   bzf->strm.opaque   = (void)
  (intptr_t)small;\n*** End Patch"

  Let's try.
• Ran apply_patch
  └ /bin/bash: line 1: apply_patch: command not found

Then in went into the rabbit hole thinking why apply_patch tool does not work.

So basically ollama launch codex does not work for gpt-oss:20b. This might be codex-cli issue, but ollama launch codex is expected to configure it properly to work isn't it?

Repro

I request a simple change to modify bzip2:

$ git clone https://sourceware.org/git/bzip2.git
$ cd bzip2
$ ollama launch codex --model gpt-oss:20b
> Implement multiple concatenated streams support in `BZ2_bzread` (zlib-compatibility API).

OS

Linux

GPU

Nvidia

CPU

Intel

Ollama version

0.17.7

extent analysis

Fix Plan

The fix involves modifying the apply_patch command to properly escape newlines and ensuring the codex-cli is correctly configured.

  • Update the apply_patch command to use a multiline string with escaped newlines:
patch_string = """*** Begin Patch
*** Update File: bzlib.c
@@
-   bzf->strm.bzalloc  = NULL;
-   bzf->strm.bzfree   = NULL;
-   bzf->strm.opaque   = NULL;
+   bzf->strm.bzalloc  = NULL;
+   bzf->strm.bzfree   = NULL;
+   /* Preserve small flag */
+   bzf->strm.opaque   = (void*)(intptr_t)small;
*** End Patch"""
  • Use triple quotes to define the multiline string and escape newlines using \n:
patch_string = """*** Begin Patch\n*** Update File: bzlib.c\n@@\n-   bzf->strm.bzalloc  = NULL;\n-   bzf->strm.bzfree   = NULL;\n-   bzf->strm.opaque   = NULL;\n+   bzf->strm.bzalloc  = NULL;\n+   bzf->strm.bzfree   = NULL;\n+   /* Preserve small flag */\n+   bzf->strm.opaque   = (void*)(intptr_t)small;\n*** End Patch"""
  • Ensure the codex-cli is correctly configured by checking the ollama launch codex command and its dependencies.

Verification

To verify the fix, run the ollama launch codex command with the modified apply_patch command and check if the patch is applied successfully.

Extra Tips

  • Make sure to update the codex-cli to the latest version to ensure compatibility with the ollama launch codex command.
  • Check the dependencies required by the ollama launch codex command and ensure they are installed and configured correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING