Github plugin having duplicate Authorization header (problem with private repos?) #4435

Closed
opened 2026-02-16 17:43:46 -05:00 by yindo · 12 comments
Owner

Originally created by @mzealey on GitHub (Jan 8, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Trying to make it generate a commit for an issue:

remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/.../': The requested URL returned error: 400
1069 |             await $`git commit -m "${summary}
1070 | 
Creating comment...
1071 | Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
1072 |           }
1073 |         }
1074 |         await $`git push -u origin ${branch}`
                      ^
ShellError: Failed with exit code 128
 exitCode: 128,
   stdout: "",
   stderr: "remote: Duplicate header: \"Authorization\"\nfatal: unable to access 'https://github.com/.../': The requested URL returned error: 400\n",
      at new ShellPromise (75:16)
      at BunShell (191:35)
      at pushToNewBranch (src/cli/cmd/github.ts:1074:15)

It should have all the required permissions:

  name: opencode
  
  on:
    issue_comment:
      types: [created]
    pull_request_review_comment:
      types: [created]
  
  permissions:
    id-token: write
    contents: write
    pull-requests: write
    issues: write
  
  jobs:
    opencode:
      if: |
        contains(github.event.comment.body, ' /oc') ||
        startsWith(github.event.comment.body, '/oc') ||
        contains(github.event.comment.body, ' /opencode') ||
        startsWith(github.event.comment.body, '/opencode')
      runs-on: ubuntu-latest
      steps:
        - name: Checkout repository
          uses: actions/checkout@v6
  
        - name: Run opencode
          uses: anomalyco/opencode/github@latest
          env:
            ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          with:
            model: anthropic/claude-opus-4-5

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

github runners

Terminal

No response

Originally created by @mzealey on GitHub (Jan 8, 2026). Originally assigned to: @thdxr on GitHub. ### Description Trying to make it generate a commit for an issue: ``` remote: Duplicate header: "Authorization" fatal: unable to access 'https://github.com/.../': The requested URL returned error: 400 1069 | await $`git commit -m "${summary} 1070 | Creating comment... 1071 | Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"` 1072 | } 1073 | } 1074 | await $`git push -u origin ${branch}` ^ ShellError: Failed with exit code 128 exitCode: 128, stdout: "", stderr: "remote: Duplicate header: \"Authorization\"\nfatal: unable to access 'https://github.com/.../': The requested URL returned error: 400\n", at new ShellPromise (75:16) at BunShell (191:35) at pushToNewBranch (src/cli/cmd/github.ts:1074:15) ``` It should have all the required permissions: ``` name: opencode on: issue_comment: types: [created] pull_request_review_comment: types: [created] permissions: id-token: write contents: write pull-requests: write issues: write jobs: opencode: if: | contains(github.event.comment.body, ' /oc') || startsWith(github.event.comment.body, '/oc') || contains(github.event.comment.body, ' /opencode') || startsWith(github.event.comment.body, '/opencode') runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v6 - name: Run opencode uses: anomalyco/opencode/github@latest env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} with: model: anthropic/claude-opus-4-5 ``` ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System github runners ### Terminal _No response_
yindo added the bug label 2026-02-16 17:43:46 -05:00
yindo closed this issue 2026-02-16 17:43:46 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 8, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #5328: Remote MCPs with auth header broke in latest update (shows same 'Duplicate header: Authorization' error)
  • #1417: GitHub Integration is not pushing changes in PRs
  • #3893: [Github agent] If the agent commits but doesn't push, the resulting commits are never pushed

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 8, 2026): This issue might be a duplicate of existing issues. Please check: - #5328: Remote MCPs with auth header broke in latest update (shows same 'Duplicate header: Authorization' error) - #1417: GitHub Integration is not pushing changes in PRs - #3893: [Github agent] If the agent commits but doesn't push, the resulting commits are never pushed Feel free to ignore if none of these address your specific case.
Author
Owner

@mzealey commented on GitHub (Jan 8, 2026):

I believe this is different from the MCP issue above

@mzealey commented on GitHub (Jan 8, 2026): I believe this is different from the MCP issue above
Author
Owner

@mzealey commented on GitHub (Jan 10, 2026):

setting TOKEN: "${{ secrets.GITHUB_TOKEN }}" does not fix the issue in 1.1.11

@mzealey commented on GitHub (Jan 10, 2026): setting `TOKEN: "${{ secrets.GITHUB_TOKEN }}"` does not fix the issue in 1.1.11
Author
Owner

@lucapette commented on GitHub (Jan 12, 2026):

Just run into this. Not sure if #7562 is supposed to fix this (to be fair I'm unsure it's in opencode-Linux-X64-v1.1.14)

@lucapette commented on GitHub (Jan 12, 2026): Just run into this. Not sure if #7562 is supposed to fix this (to be fair I'm unsure it's in opencode-Linux-X64-v1.1.14)
Author
Owner

@rekram1-node commented on GitHub (Jan 12, 2026):

hmmm

@rekram1-node commented on GitHub (Jan 12, 2026): hmmm
Author
Owner

@pid1 commented on GitHub (Jan 12, 2026):

This job works as a workaround

name: opencode

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]

jobs:
  opencode:
    if: |
      contains(github.event.comment.body, '/oc') ||
      contains(github.event.comment.body, '/opencode')
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: write
      pull-requests: write
      issues: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
        with:
          fetch-depth: 1

      - name: Clear checkout auth header
        run: git config --local --unset-all http.https://github.com/.extraheader || true

      - name: Run OpenCode
        uses: anomalyco/opencode/github@latest
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          model: anthropic/claude-opus-4-5
          share: true
          use_github_token: true
@pid1 commented on GitHub (Jan 12, 2026): This job works as a workaround ```yaml name: opencode on: issue_comment: types: [created] pull_request_review_comment: types: [created] jobs: opencode: if: | contains(github.event.comment.body, '/oc') || contains(github.event.comment.body, '/opencode') runs-on: ubuntu-latest permissions: id-token: write contents: write pull-requests: write issues: write steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 - name: Clear checkout auth header run: git config --local --unset-all http.https://github.com/.extraheader || true - name: Run OpenCode uses: anomalyco/opencode/github@latest env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: model: anthropic/claude-opus-4-5 share: true use_github_token: true ```
Author
Owner

@LeonMueller-OneAndOnly commented on GitHub (Jan 13, 2026):

Cleaner Solution: persist-credentials: false

Rather than clearing the auth header after checkout, a cleaner fix is to prevent actions/checkout@v6 from persisting credentials in the first place:

steps:
  - uses: actions/checkout@v6
    with:
      persist-credentials: false  # Prevents duplicate Authorization header
  - uses: anomalyco/opencode/github@latest

Root Cause

  1. actions/checkout@v6 persists the GitHub token to git config via http.extraheader
  2. The anomalyco/opencode/github@latest action then adds its own authentication
  3. Both Authorization headers get sent to GitHub → 400 error

Suggested Fix for OpenCode

The default workflow templates should be updated to include persist-credentials: false. This affects:

  • opencode setup command output in the TUI
  • Documentation examples (scheduled review workflows)
  • Any template files in the repository (e.g., opencode-review.yml, opencode.yml)

This would prevent users from encountering this issue when following the official setup instructions.

@LeonMueller-OneAndOnly commented on GitHub (Jan 13, 2026): ## Cleaner Solution: `persist-credentials: false` Rather than clearing the auth header after checkout, a cleaner fix is to prevent `actions/checkout@v6` from persisting credentials in the first place: ```yaml steps: - uses: actions/checkout@v6 with: persist-credentials: false # Prevents duplicate Authorization header - uses: anomalyco/opencode/github@latest ``` ### Root Cause 1. `actions/checkout@v6` persists the GitHub token to git config via `http.extraheader` 2. The `anomalyco/opencode/github@latest` action then adds its own authentication 3. Both Authorization headers get sent to GitHub → 400 error ### Suggested Fix for OpenCode The default workflow templates should be updated to include `persist-credentials: false`. This affects: - **`opencode setup` command output** in the TUI - **Documentation examples** (scheduled review workflows) - **Any template files** in the repository (e.g., `opencode-review.yml`, `opencode.yml`) This would prevent users from encountering this issue when following the official setup instructions.
Author
Owner

@mzealey commented on GitHub (Jan 13, 2026):

https://github.com/anomalyco/opencode/issues/7325#issuecomment-3743864279 is the correct solution thanks

@mzealey commented on GitHub (Jan 13, 2026): https://github.com/anomalyco/opencode/issues/7325#issuecomment-3743864279 is the correct solution thanks
Author
Owner

@lucapette commented on GitHub (Jan 13, 2026):

I can confirm that #7325 works! thank you @LeonMueller-OneAndOnly to for taking care of it!

@lucapette commented on GitHub (Jan 13, 2026): I can confirm that #7325 works! thank you @LeonMueller-OneAndOnly to for taking care of it!
Author
Owner

@rekram1-node commented on GitHub (Jan 13, 2026):

thanks!!

@rekram1-node commented on GitHub (Jan 13, 2026): thanks!!
Author
Owner

@brunocrosier commented on GitHub (Jan 14, 2026):

i'm still experiencing this with the following.. any idea what i might be missing? 🙏🏼

name: opencode

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]

jobs:
  opencode:
    if: |
      contains(github.event.comment.body, '/oc') ||
      contains(github.event.comment.body, '/opencode')
    runs-on: ubuntu-latest
    permissions:
      id-token: write
    steps:
       - name: Checkout repository
         uses: actions/checkout@v6
         with:
           fetch-depth: 1
           persist-credentials: false

       - name: Run opencode
        uses: anomalyco/opencode/github@latest
        env:
          OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
        with:
          model: opencode/big-pickle

the error in the comment is:

remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/brunocrosier/impostor/': The requested URL returned error: 400

the run output is:

█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀  ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀


OpenCode includes free models, to start:

cd <project>  # Open directory
opencode      # Run command

For more information visit https://opencode.ai/docs


Run echo "$HOME/.opencode/bin" >> $GITHUB_PATH
Run opencode github run
Images []
Configuring git...
Asserting permissions for user brunocrosier...
  permission: admin
Adding reaction...
opencode session ses_444393b4bffe6anZtd2SSlaf7a
Fetching prompt data for PR...
Checking out local branch...
remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/brunocrosier/redacted/': The requested URL returned error: 400
Failed with exit code 128
Creating comment...
Removing reaction...
Error: remote: Duplicate header: "Authorization"
fatal: unable to access 'https://github.com/brunocrosier/redacted/': The requested URL returned error: 400

Error: Process completed with exit code 1.
@brunocrosier commented on GitHub (Jan 14, 2026): i'm still experiencing this with the following.. any idea what i might be missing? 🙏🏼 ```yml name: opencode on: issue_comment: types: [created] pull_request_review_comment: types: [created] jobs: opencode: if: | contains(github.event.comment.body, '/oc') || contains(github.event.comment.body, '/opencode') runs-on: ubuntu-latest permissions: id-token: write steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 1 persist-credentials: false - name: Run opencode uses: anomalyco/opencode/github@latest env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} with: model: opencode/big-pickle ``` the error in the comment is: ``` remote: Duplicate header: "Authorization" fatal: unable to access 'https://github.com/brunocrosier/impostor/': The requested URL returned error: 400 ``` the run output is: ``` █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ OpenCode includes free models, to start: cd <project> # Open directory opencode # Run command For more information visit https://opencode.ai/docs Run echo "$HOME/.opencode/bin" >> $GITHUB_PATH Run opencode github run Images [] Configuring git... Asserting permissions for user brunocrosier... permission: admin Adding reaction... opencode session ses_444393b4bffe6anZtd2SSlaf7a Fetching prompt data for PR... Checking out local branch... remote: Duplicate header: "Authorization" fatal: unable to access 'https://github.com/brunocrosier/redacted/': The requested URL returned error: 400 Failed with exit code 128 Creating comment... Removing reaction... Error: remote: Duplicate header: "Authorization" fatal: unable to access 'https://github.com/brunocrosier/redacted/': The requested URL returned error: 400 Error: Process completed with exit code 1. ```
Author
Owner

@brunocrosier commented on GitHub (Jan 14, 2026):

sorry actually ignore my previous comment! it works correctly -i just needed to actually merge the workflow.

@brunocrosier commented on GitHub (Jan 14, 2026): sorry actually ignore my previous comment! it works correctly -i just needed to actually merge the workflow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4435