openclaw - 💡(How to fix) Fix pdf tool fails with openai-codex/gpt-5.5: "Instructions are required" [2 comments, 3 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
openclaw/openclaw#77872Fetched 2026-05-06 06:19:57
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×2

The pdf tool fails when configured to use openai-codex/gpt-5.5 as the PDF model.

Reproduced on:

OpenClaw 2026.5.4 (325df3e)

Model:

openai-codex/gpt-5.5

Error:

PDF model failed (openai-codex/gpt-5.5): Codex error: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"Instructions are required"}}

Error Message

PDF model failed (openai-codex/gpt-5.5): Codex error: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"Instructions are required"}}

Root Cause

The pdf tool fails when configured to use openai-codex/gpt-5.5 as the PDF model.

Reproduced on:

OpenClaw 2026.5.4 (325df3e)

Model:

openai-codex/gpt-5.5

Error:

PDF model failed (openai-codex/gpt-5.5): Codex error: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"Instructions are required"}}

Fix Action

Fix / Workaround

After upgrading to OpenClaw 2026.5.4, a previous local workaround was overwritten by the update, and the failure reappeared.

Validated local workaround

With this workaround, the same selectable-text PDF smoke test succeeds.

Code Example

OpenClaw 2026.5.4 (325df3e)

---

openai-codex/gpt-5.5

---

PDF model failed (openai-codex/gpt-5.5): Codex error: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"Instructions are required"}}

---

{
  "agents": {
    "defaults": {
      "pdfModel": {
        "primary": "openai-codex/gpt-5.5",
        "fallbacks": []
      }
    }
  },
  "tools": {
    "profile": "coding",
    "alsoAllow": ["pdf"]
  }
}

---

What text does this PDF contain? Keep the answer concise.

---

Instructions are required

---

function buildPdfExtractionContext(prompt, extractions) {
  // ...builds content from extracted PDF text/images and user prompt...
  return {
    messages: [{
      role: "user",
      content,
      timestamp: Date.now()
    }]
  };
}

---

instructions: context.systemPrompt

---

return {
  systemPrompt: "You are a helpful assistant. Use the extracted PDF content provided by the user message to answer accurately. If the content is insufficient, say so.",
  messages: [{
    role: "user",
    content,
    timestamp: Date.now()
  }]
};
RAW_BUFFERClick to expand / collapse

Summary

The pdf tool fails when configured to use openai-codex/gpt-5.5 as the PDF model.

Reproduced on:

OpenClaw 2026.5.4 (325df3e)

Model:

openai-codex/gpt-5.5

Error:

PDF model failed (openai-codex/gpt-5.5): Codex error: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"Instructions are required"}}

Reproduction steps

  1. Configure the PDF tool to use Codex only:
{
  "agents": {
    "defaults": {
      "pdfModel": {
        "primary": "openai-codex/gpt-5.5",
        "fallbacks": []
      }
    }
  },
  "tools": {
    "profile": "coding",
    "alsoAllow": ["pdf"]
  }
}
  1. Use the pdf tool on a small selectable-text PDF.
  2. Prompt example:
What text does this PDF contain? Keep the answer concise.

Current behavior

The pdf tool is available and local extraction appears to run, but the model call fails with:

Instructions are required

This reproduces both in the current session and in a newly spawned session.

After upgrading to OpenClaw 2026.5.4, a previous local workaround was overwritten by the update, and the failure reappeared.

Expected behavior

The pdf tool should successfully pass extracted PDF text/images to openai-codex/gpt-5.5 and receive a normal assistant response.

Probable cause

In the PDF extraction fallback path, buildPdfExtractionContext() returns a context with user messages only and no systemPrompt.

Conceptually:

function buildPdfExtractionContext(prompt, extractions) {
  // ...builds content from extracted PDF text/images and user prompt...
  return {
    messages: [{
      role: "user",
      content,
      timestamp: Date.now()
    }]
  };
}

The OpenAI Codex Responses provider builds the request using:

instructions: context.systemPrompt

So the Codex request receives missing/undefined instructions, causing the API error.

Validated local workaround

Adding a short neutral systemPrompt to the PDF extraction context fixes the issue locally:

return {
  systemPrompt: "You are a helpful assistant. Use the extracted PDF content provided by the user message to answer accurately. If the content is insufficient, say so.",
  messages: [{
    role: "user",
    content,
    timestamp: Date.now()
  }]
};

With this workaround, the same selectable-text PDF smoke test succeeds.

Proposed minimal fix

Add a default systemPrompt in buildPdfExtractionContext() for the non-native PDF extraction fallback path.

The prompt should be brief, neutral, and PDF-specific. It should not include user/private content.

Risks / considerations

  • Low behavioral risk: the prompt is generic and only guides PDF answering.
  • This affects the PDF extraction fallback path for non-native PDF providers.
  • The wording should avoid being provider-specific unless maintainers prefer a Codex-only conditional.
  • Existing providers that do not require systemPrompt should continue to work.

extent analysis

TL;DR

Add a default systemPrompt to the buildPdfExtractionContext() function to fix the openai-codex/gpt-5.5 model failure.

Guidance

  • Verify that the buildPdfExtractionContext() function is indeed returning a context with missing systemPrompt by adding logging or debugging statements.
  • Implement the proposed minimal fix by adding a default systemPrompt to the buildPdfExtractionContext() function, such as the one described in the validated local workaround.
  • Test the fix with the provided reproduction steps to ensure the pdf tool works as expected with the openai-codex/gpt-5.5 model.
  • Consider the risks and considerations mentioned, such as the potential impact on existing providers and the need for a generic, provider-agnostic systemPrompt.

Example

function buildPdfExtractionContext(prompt, extractions) {
  // ...builds content from extracted PDF text/images and user prompt...
  return {
    systemPrompt: "You are a helpful assistant. Use the extracted PDF content provided by the user message to answer accurately. If the content is insufficient, say so.",
    messages: [{
      role: "user",
      content,
      timestamp: Date.now()
    }]
  };
}

Notes

The fix assumes that the buildPdfExtractionContext() function is the root cause of the issue, and that adding a default systemPrompt will resolve the problem. However, further testing and verification may be necessary to ensure the fix works in all scenarios.

Recommendation

Apply the proposed minimal fix by adding a default systemPrompt to the buildPdfExtractionContext() function, as it is a low-risk change that should resolve the issue with the openai-codex/gpt-5.5 model.

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…

FAQ

Expected behavior

The pdf tool should successfully pass extracted PDF text/images to openai-codex/gpt-5.5 and receive a normal assistant response.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING