Skip to content

/opencode raise an error in github actions #2549

Closed

Description

@fbraza

I was making a couple of test recently using the opencode Github action.

Here is the yaml file

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@v4
        with:
          fetch-depth: 1

      - name: Run opencode
        uses: sst/opencode/github@latest
        env:
          OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
        with:
          model: openrouter/anthropic/claude-sonnet-4
          share: true

Here the error log on Github

Run sst/opencode/github@latest
  with:
    model: openrouter/anthropic/claude-sonnet-4
    share: true
  env:
    OPENROUTER_API_KEY: ***
Run curl -fsSL https://opencode.ai/install | bash
  curl -fsSL https://opencode.ai/install | bash
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    OPENROUTER_API_KEY: ***
    VERSION: 0.5.29
Downloading opencode version: 0.5.29 ...

######################################################################## 100.0%

Successfully added opencode to $PATH in /home/runner/.bashrc
Added /home/runner/.opencode/bin to $GITHUB_PATH

Run opencode github run
  opencode github run
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    OPENROUTER_API_KEY: ***
    MODEL: openrouter/anthropic/claude-sonnet-4
    SHARE: true
  
opencode github
manage GitHub agent
Commands:
  opencode github install  install the GitHub agent
Options:
      --help        show help                                          [boolean]
  -v, --version     show version number                                [boolean]
      --print-logs  print logs to stderr                               [boolean]
      --log-level   log level
                            [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
Error: Process completed with exit code 1.

A couple of thing I am surprised about:

  1. The version 0.5.29 of opencode is being download
  2. This is very strange
Commands:
  opencode github install  install the GitHub agent
Options:
      --help        show help                                          [boolean]
  -v, --version     show version number                                [boolean]
      --print-logs  print logs to stderr                               [boolean]
      --log-level   log level
                            [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]

It is running the help / doc of the cli. It seems like something may be wrong with the command being triggered.

Let me know if you need anything more. The yaml is made with OpenRouter but I also tested directly with my Claude Max subscription and got the exact same error.

Many thanks

Cheers

Activity

  1. fbraza commented on Sep 11, 2025

    @fbraza
    Author

    Ok.

    Out of ignorance, because it runs the curl -fsSL https://opencode.ai/install | bash I thought it will get the most up to date version. How did you pin this? I cannot find anything on the github folder or action.yml file.

    Second do you think this may be the root cause of the error?

    Cheers

  2. harrismcc commented on Sep 12, 2025

    @harrismcc

    I'm getting the same error on my repo, I just setup opencode in it today

  3. notlousybook commented on Sep 13, 2025

    @notlousybook

    same error guys, when fixing this? and does /oc work here?

  4. tudragon154203 commented on Sep 14, 2025

    @tudragon154203

    /opencode can you take a look?

  5. rmoriz commented on Sep 17, 2025

    @rmoriz
    Contributor

    "@latest" resolves to the latest tag of this repo which is right now 2 weeks behind the dev HEAD.

    When using @v0.9.11 i'm getting a error related to bun v1.2.22

  6. anglisano commented on Sep 19, 2025

    @anglisano

    Same error here, there are some temporal solution? Or version that we can use until the latest work?

    2025-09-19T14:42:20.5329362Z ##[group]Run sst/opencode/github@latest
    with:
    model: google/gemini-1.5-pro
    env:
    GOOGLE_GENERATIVE_AI_API_KEY: ***
    Run curl -fsSL https://opencode.ai/install | bash
    Downloading opencode version: 0.5.29 ...
    #=#=#
    ##O#-#

                                                                           0.0%
    

    ############# 18.2%
    ################# 24.0%
    #################### 28.9%
    ######################## 34.1%
    ############################# 40.9%
    ################################ 45.1%
    ############################################# 62.9%
    ################################################## 70.2%
    ############################################################## 87.1%
    ################################################################# 91.4%
    ######################################################################## 100.0%
    Successfully added opencode to $PATH in /home/runner/.bashrc
    Added /home/runner/.opencode/bin to $GITHUB_PATH
    Run opencode github run
    opencode github

    manage GitHub agent

    Commands:
    opencode github install install the GitHub agent

    Options:
    --help show help [boolean]
    -v, --version show version number [boolean]
    --print-logs print logs to stderr [boolean]
    --log-level log level
    [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
    Process completed with exit code 1.

  7. m9tdev commented on Sep 19, 2025

    @m9tdev

    Same here.

    Also tried to pin to the latest version manually using:

          - name: Run opencode
            uses: sst/opencode/github@v0.10.2
            env:
              OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
              VERSION: 0.10.2
            with:
              model: opencode/grok-code
    

    but that results in the following error:

    Run sst/opencode/github@v0.10.2
    Run curl -fsSL https://opencode.ai/install | bash
    Downloading opencode version: 0.10.2 ...
    #=#=#                                                                          
    
    ##########                                                                14.0%
    ###################################################################       93.1%
    ######################################################################## 100.0%
    Successfully added opencode to $PATH in /home/runner/.bashrc
    Added /home/runner/.opencode/bin to $GITHUB_PATH
    Run npm install -g bun
    
    added 5 packages in 7s
    Run cd ${GITHUB_ACTION_PATH}
      cd ${GITHUB_ACTION_PATH}
      bun install
      shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
      env:
        OPENCODE_API_KEY: ***
        VERSION: 0.10.2
    bun install v1.2.22 (6bafe260)
    error: @types/bun@catalog: failed to resolve
    Error: Process completed with exit code 1.
    
  8. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Contributor

    I will raise this to the team

  9. fwang commented on Sep 19, 2025

    @fwang
    Contributor

    should be fixed!

    give it a try

  10. rekram1-node commented on Sep 19, 2025

    @rekram1-node
    Contributor

    tested seems fixed

  11. m9tdev commented on Sep 19, 2025

    @m9tdev

    Uses 0.5.5 now for me. It does seem to get further, but (i guess) because of the old version it doesn't support the opencode provider yet

    7s
    Run sst/opencode/github@latest
    Run curl -fsSL https://opencode.ai/install | bash
    Downloading opencode version: 0.5.5 ...
    #=#=#                                                                          
    ###################                                                       27.1%
    #####################################################                     74.3%
    ######################################################################    97.3%
    ######################################################################## 100.0%
    Successfully added opencode to $PATH in /home/runner/.bashrc
    Added /home/runner/.opencode/bin to $GITHUB_PATH
    Run opencode github run
      
    Images []
    Configuring git...
    AUTHORIZATION: basic ***
    Asserting permissions for user m9tdev...
      permission: admin
    Creating comment...
    opencode session ses_69c3622a3ffe7jFIOoxZtd7Ipt
    Checking out new branch...
    Switched to a new branch 'opencode/issue87-20250919210317'
    Fetching prompt data for issue...
    Sending message to opencode...
    1 | (function (...args) { super(...args); })
                              ^
    ProviderModelNotFoundError: ProviderModelNotFoundError
     data: {
      providerID: "opencode",
      modelID: "grok-code",
    },
          at new NamedError (1:23)
          at new ProviderModelNotFoundError (/$bunfs/root/opencode:59469:9)
          at getModel (/$bunfs/root/opencode:116933:13)
    Updating comment...
    

    Seems that providing the VERSION env var doesn't have an effect and using uses: sst/opencode/github@dev in combination with the env var results in the same error as using sst/opencode/github@v0.10.2

  12. fwang commented on Sep 19, 2025

    @fwang
    Contributor

    @m9tdev ah got it. im in the middle of revamping the gh actions stuff.. will try to get a version out early next week.

  13. fbraza commented on Sep 20, 2025

    @fbraza
    Author

    You rock @fwang thank loads for the good work. Looking forward

  14. rohit-gohri commented on Sep 22, 2025

    @rohit-gohri

    Still an issue - downloading 0.5.5 version

    Image
  15. rekram1-node commented on Sep 22, 2025

    @rekram1-node
    Contributor

    @rohit-gohri can you share your action yml definition?

  16. rohit-gohri commented on Sep 22, 2025

    @rohit-gohri

    I'm trying to use with GITHUB_TOKEN rather than with app

    I tried with latest and it gave me this error:

    124272 |           method: "POST",
    124273 |           headers: {
    124274 |             Authorization: `***
    124275 |           }
    124276 |         });
    124277 |           const responseJson2 = await response2.json();
                                                                 ^
    SyntaxError: Failed to parse JSON
          at exchangeForAppToken (/$bunfs/root/opencode:124277:53)
    
    

    I also tried using sst/opencode/github@dev and it gave me this error:

    bun install v1.2.22 (6bafe260)
    error: @types/bun@catalog: failed to resolve
    
    # SEE: https://opencode.ai/docs/github/
    name: opencode
    
    on:
      issue_comment:
        types: [created]
    
    jobs:
      opencode:
        if: |
          contains(github.event.comment.body, '/oc') ||
          contains(github.event.comment.body, '/opencode')
    
        runs-on: dp-ubuntu-2204 # self-hosted runner
    
        permissions:
          id-token: write
          contents: write
          pull-requests: write
          issues: write
          packages: read
    
        steps:
          - name: Checkout repository
            uses: actions/checkout@v5
            with:
              fetch-depth: 1
    
          - name: Create user config opencode.json
            run: |
              mkdir -p ~/.config/opencode
              cp opencode.json > ~/.config/opencode/opencode.json
    
          - name: Install and configure Node.js
            uses: actions/setup-node@v5
            with:
              node-version: "22.x"
    
          - name: Run opencode
            uses: sst/opencode/github@latest
            # Don't let LLM spend too many tokens/time on a task
            timeout-minutes: 10
            env:
              LITE_LLM_API_KEY: ${{ secrets.LITE_LLM_API_KEY }}
            with:
              share: false
              token: ${{ secrets.GITHUB_TOKEN }}
              model: "lite_llm/vertex_ai/claude-sonnet-4" # defined in opencode.json
  17. rekram1-node commented on Sep 22, 2025

    @rekram1-node
    Contributor

    token: ${{ secrets.GITHUB_TOKEN }}

    this is the issue

    remove that it should work

  18. rohit-gohri commented on Sep 22, 2025

    @rohit-gohri

    @rekram1-node it doesn't work if I remove the token:

    Run sst/opencode/github@latest
      with:
        share: false
        model: lite_llm/vertex_ai/claude-sonnet-4
      env:
        LITE_LLM_API_KEY: ***
    Run curl -fsSL https://opencode.ai/install | bash
      
    Downloading opencode version: 0.5.5 ...
    #####################                                                     29.3%
    ######################################################################## 100.0%
    Successfully added opencode to $PATH in /home/runner/.bashrc
    Added /home/runner/.opencode/bin to $GITHUB_PATH
    Run opencode github run
      opencode github run
      shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
      env:
        LITE_LLM_API_KEY: ***
        MODEL: lite_llm/vertex_ai/claude-sonnet-4
        SHARE: false
      
    124272 |           method: "POST",
    124273 |           headers: {
    124274 |             Authorization: `***
    124275 |           }
    124276 |         });
    124277 |           const responseJson2 = await response2.json();
                                                                 ^
    SyntaxError: Failed to parse JSON
          at exchangeForAppToken (/$bunfs/root/opencode:124277:53)
    Error: Failed to parse JSON
    Error: Process completed with exit code 1.
    
  19. rohit-gohri commented on Sep 22, 2025

    @rohit-gohri

    The only way I got it working was with this fork - dev...rohit-gohri:opencode:dev
    where I upgraded "@opencode-ai/sdk" to "0.11.1" and fixed build issues ( with opencode locally 😅 )

    Happy to open a PR though not sure if this is the direction you want to go

  20. rekram1-node commented on Sep 22, 2025

    @rekram1-node
    Contributor

    @fwang is in charge of github action so he would know what is best here

  21. rmoriz commented on Sep 22, 2025

    @rmoriz
    Contributor

    Also wonder if Github Workflow integration works at all with Githup Copilot. If not, that should be documented. I didn't manage to get it working at all a couple of days ago.

  22. beaussan commented on Oct 6, 2025

    @beaussan

    For anyone finding this comment, one version of the github action that actually works is 0.6.10, since it's the last commit (from a month ago) that didn't had the catalog: as bun types versions

    Currently "works" with the following:

    name: opencode
    
    on:
      issue_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@v4
            with:
              fetch-depth: 1
          - name: Run opencode
            uses: sst/opencode/github@v0.6.10
            env:
              ...
            with:
              model: ...
              share: false
              token: ${{ secrets.GITHUB_TOKEN }}
    

    @fwang if there is a way to try / help out the new github integration, let me know!

  23. jtag05 commented on Oct 28, 2025

    @jtag05

    I'm not seeing a more appropriate issue to lend my voice to but I am still experiencing this with @latest attemtping to use zai-coding-plan/glm-4.6. Pinning the version to v0.6.10 works but seems to choking when I enable the posthog mcp I have wired up. Happy to open a new issue if that's preferable.

  24. rekram1-node commented on Oct 28, 2025

    @rekram1-node
    Contributor

    new issue would be great @jtag05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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