Skip to content

TypeError: undefined is not an object (evaluating 'a.name') - Only happening after upgrade #49365

Closed

Description

@MiguVT

Description

Saw lot of issues opened but no one provided logs cleanly, soo here it goes:

miguvt@nixos /e/nixos (main) [1]> opencode --print-logs --log-level DEBUG run "hi"
timestamp=2026-09-16T16:37:39.336Z level=INFO run=d2699f38 message="creating instance" directory=/etc/nixos
timestamp=2026-09-16T16:37:39.337Z level=INFO run=d2699f38 message=fromDirectory directory=/etc/nixos
timestamp=2026-09-16T16:37:39.359Z level=INFO run=d2699f38 message=bootstrapping directory=/etc/nixos
timestamp=2026-09-16T16:37:39.365Z level=INFO run=d2699f38 message=loading path=/home/miguvt/.config/opencode/config.json
timestamp=2026-09-16T16:37:39.366Z level=INFO run=d2699f38 message=loading path=/home/miguvt/.config/opencode/opencode.json
timestamp=2026-09-16T16:37:39.369Z level=INFO run=d2699f38 message=loading path=/home/miguvt/.config/opencode/opencode.jsonc
timestamp=2026-09-16T16:37:39.418Z level=INFO run=d2699f38 message="all LSPs are disabled"
timestamp=2026-09-16T16:37:39.419Z level=INFO run=d2699f38 message="all formatters are disabled"
timestamp=2026-09-16T16:37:39.419Z level=INFO run=d2699f38 message=init
timestamp=2026-09-16T16:37:39.499Z level=INFO run=d2699f38 message=created id=ses_f54eb3dd4ffeYaX03UHFdIWDrD slug=hidden-orchid version=1.18.30 projectID=d310466c572f92051e7d9b1b3733725e3eaa20d8 directory=/etc/nixos path="" workspaceID=undefined parentID=undefined title="New session - 2026-09-16T16:37:39.499Z" agent=undefined model=undefined metadata=undefined permission="[{\"permission\":\"question\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"plan_enter\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"plan_exit\",\"pattern\":\"*\",\"action\":\"deny\"}]" cost=0 tokens.input=0 tokens.output=0 tokens.reasoning=0 tokens.cache.read=0 tokens.cache.write=0 time.created=1789576659499 time.updated=1789576659499
timestamp=2026-09-16T16:37:39.507Z level=INFO run=d2699f38 message="event connected"
timestamp=2026-09-16T16:37:39.767Z level=INFO run=d2699f38 message=loop session.id=ses_f54eb3dd4ffeYaX03UHFdIWDrD step=0

> build · qwen3.8-27b

timestamp=2026-09-16T16:37:39.773Z level=INFO run=d2699f38 message=stream providerID=local-llama modelID=qwen3.8-27b session.id=ses_f54eb3dd4ffeYaX03UHFdIWDrD small=true agent=title mode=primary
timestamp=2026-09-16T16:37:39.781Z level=INFO run=d2699f38 message="llm runtime selected" llm.runtime=ai-sdk llm.provider=local-llama llm.model=qwen3.8-27b
timestamp=2026-09-16T16:37:39.790Z level=ERROR run=d2699f38 message="stream error" providerID=local-llama modelID=qwen3.8-27b session.id=ses_f54eb3dd4ffeYaX03UHFdIWDrD small=true agent=title mode=primary error.error="AI_APICallError: Invalid API Key"
timestamp=2026-09-16T16:37:39.797Z level=INFO run=d2699f38 message=tracking hash=647a091fe6ceca3693968f6310e72bf508b75def cwd=/etc/nixos git=/home/miguvt/.local/share/opencode/snapshot/d310466c572f92051e7d9b1b3733725e3eaa20d8/8662e97f990aad1524085c760436e71142424611
timestamp=2026-09-16T16:37:39.801Z level=INFO run=d2699f38 message="shell tool using shell" shell=/run/current-system/sw/bin/bash
timestamp=2026-09-16T16:37:39.806Z level=INFO run=d2699f38 message=init count=1
timestamp=2026-09-16T16:37:39.808Z level=ERROR run=d2699f38 message=failed ref=err_07558542 error="TypeError: undefined is not an object (evaluating 'a.name')" cause="TypeError: undefined is not an object (evaluating 'a.name')\n    at resolve (/$bunfs/root/chunk-2txybz4b.js:2:1659)\n    at a (/$bunfs/root/chunk-2txybz4b.js:2:936)\n    at map (native:1:11)\n    at <anonymous> (/$bunfs/root/chunk-2txybz4b.js:2:1626)\n    at a (/$bunfs/root/chunk-2txybz4b.js:2:1166)\n    at map (native:1:11)\n    at <anonymous> (/$bunfs/root/chunk-2txybz4b.js:2:1626)\n    at a (/$bunfs/root/chunk-2txybz4b.js:2:1166)\n    at map (native:1:11)\n    at <anonymous> (/$bunfs/root/chunk-2txybz4b.js:2:1390)\n    at SystemPrompt.environment (/$bunfs/root/chunk-bea263sy.js:50:13096)\n    at SystemPrompt.environment (definition) (/$bunfs/root/chunk-bea263sy.js:4:14254)\n    at SessionPrompt.run (/$bunfs/root/chunk-bea263sy.js:50:14576)\n    at SessionPrompt.run (definition) (/$bunfs/root/chunk-bea263sy.js:50:10099)\n    at SessionRunState.ensureRunning (/$bunfs/root/chunk-bea263sy.js:50:14545)\n    at SessionRunState.ensureRunning (definition) (/$bunfs/root/chunk-bea263sy.js:2:6720)\n    at SessionPrompt.loop (/$bunfs/root/chunk-bea263sy.js:50:9849)\n    at SessionPrompt.loop (definition) (/$bunfs/root/chunk-bea263sy.js:50:14481)\n    at SessionPrompt.prompt (/$bunfs/root/chunk-f9g4vqca.js:6:11695)\n    at SessionPrompt.prompt (definition) (/$bunfs/root/chunk-bea263sy.js:50:9462)"
Error: {
  "name": "UnknownError",
  "data": {
    "message": "Unexpected server error. Check server logs for details.",
    "ref": "err_07558542"
  }
}
timestamp=2026-09-16T16:37:39.809Z level=INFO run=d2699f38 message="disposing instance" directory=/etc/nixos
miguvt@nixos /e/nixos (main) [1]> 

While my config is:

{ pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    (llama-cpp.override { cudaSupport = true; })
    opencode
  ];

  environment.sessionVariables = {
    AI_MODELS_PATH = "/mnt/data/llamasrv/Models";
  };

  networking.firewall.allowedTCPPorts = [
    8001 # llama-server
  ];

  home-manager.users.miguvt = {
    xdg.configFile."opencode/opencode.json".text = builtins.toJSON {
      "$schema" = "https://opencode.ai/config.json";
      "provider" = {
        "local-llama" = {
          "npm" = "@ai-sdk/openai-compatible";
          "name" = "Local Llama Server";
          "options" = {
            "baseURL" = "http://127.0.0.1:8001/v1";
          };
          "models" = {
            "qwen3.8-27b" = {
              "name" = "qwen3.8-27b (local)";
            };
          };
        };
      };

      "tools" = {
        "bash" = true;
        "edit" = true;
        "write" = true;
        "read" = true;
      };
    };
  };
}

Plugins

Default

OpenCode version

1.18.30

Steps to reproduce

  1. Just run opencode run "hi"

Screenshot and/or share link

https://opncd.ai/share/pF86jcEq

Operating System

NixOS Unstable

Terminal

Kitty

Activity

  1. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

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

  2. MiguVT commented on Sep 16, 2026

    @MiguVT
    Author

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

    * [TypeError: undefined is not an object (evaluating 'a.name')" #49158](https://github.com/anomalyco/opencode/issues/49158): TypeError: undefined is not an object (evaluating 'a.name')
    
    * [macOS: every prompt fails with "undefined is not an object (evaluating 'a.name')" #48811](https://github.com/anomalyco/opencode/issues/48811): macOS: every prompt fails with "undefined is not an object (evaluating 'a.name')"
    
    * [SystemPrompt.environment crashes on every prompt: undefined is not an object (evaluating 'a.name') #48965](https://github.com/anomalyco/opencode/issues/48965): SystemPrompt.environment crashes on every prompt: undefined is not an object (evaluating 'a.name')
    
    * [Regression in 1.18.30: every prompt crashes with TypeError in SystemPrompt.environment ("a.name") — 1.18.18 works fine #48645](https://github.com/anomalyco/opencode/issues/48645): Regression in 1.18.30: every prompt crashes with TypeError in SystemPrompt.environment ("a.name") — 1.18.18 works fine
    
    * [agent list crashes with "undefined is not an object (evaluating 'a.name')" when the config has a non-empty references block #48809](https://github.com/anomalyco/opencode/issues/48809): agent list crashes with "undefined is not an object (evaluating 'a.name')" when the config has a non-empty references block
    

    Its true that all of them are duplicated, but all of them are just people repeating things and amking everything harder to understand, here I tried to give everything as KISS (Keep It Simple Stupid) as possible to make it easy to follow.

  3. GanbaruTobi commented on Sep 16, 2026

    @GanbaruTobi

    Having the same issue

  4. ApprenticeofEnder commented on Sep 17, 2026

    @ApprenticeofEnder

    Same thing, plus I'm using Nix too, just on Nobara linux.

  5. vacy commented on Sep 18, 2026

    @vacy

    issue at bun repository oven-sh/bun#42632

  6. pbek commented on Sep 19, 2026

    @pbek

    My workaround is pinning to an old version of bun: pbek/nixcfg@bf0bce8

  7. lfos commented on Sep 23, 2026

    @lfos

    We (Arch Linux packagers) have reported this upstream at oven-sh/bun#42632 as @vacy has already pointed out and temporarily pinned bun to 1.4.0 in our opencode package.

  8. MiguVT commented on Sep 23, 2026

    @MiguVT
    Author

    Works well on OpenCode v2, here is how I managed to install OpenCode v2 on git.miguvt.com - my own forgejo instance or if you guys prefer github MiguVT/nixos-config-mirror@fd4720a

  9. zevisert commented on Sep 23, 2026

    @zevisert

    For other nix users, here's a similar solve to @MiguVT's - just using overrideAttrs instead of redefining the whole derivation:

    Overlays for both bun 1.4.0 and opencode 2.0.15
      overlays = [
        # Each overlay is a function that takes two arguments: final and prev
        (final: prev: {
          # Override an existing package
          bun = let
            sources = {
              "aarch64-darwin" = prev.fetchurl {
                url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-darwin-aarch64.zip";
                hash = "sha256-xmnpf2Fk4cluBwF0jbmN+ndJKQjL2DlMdVcTSnNd44E=";
              };
              "aarch64-linux" = prev.fetchurl {
                url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-aarch64.zip";
                hash = "sha256-SxozLuhhmD65O8/m93D/+U4+MbLDiL2uo8jtNeWO7Q4=";
              };
              "x86_64-linux" = prev.fetchurl {
                url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64-baseline.zip";
                hash = "sha256-GE+0WV8NQBohfPfHjBvEMLqDMU2reouUgFurv3+nCX8=";
              };
            };
          in
            prev.bun.overrideAttrs {
              version = "1.4.0";
              src = sources.${prev.stdenvNoCC.hostPlatform.system};
              passthru.sources = sources;
            };
    
          opencode = prev.opencode.overrideAttrs (finalAttrs: prevAttrs: {
            version = "2.0.15";
            src = pkgs.fetchFromGitHub {
              owner = "anomalyco";
              repo = "opencode";
              tag = "v${finalAttrs.version}";
              hash = "sha256-G4qRDwJ6i5SpsiHoej31HRPLOHpkLc66B+UmdzOY1+o=";
            };
            passthru.node_modules = prevAttrs.passthru.node_modules.overrideAttrs {
              outputHash = "sha256-d3/tMh6B+econOcX+5orEsy3aVXmfnptaR76UAyNn48=";
            };
          });
        })
      ];
  10. MiguVT commented on Sep 23, 2026

    @MiguVT
    Author

    For other nix users, here's a similar solve to @MiguVT's - just using overrideAttrs instead of redefining the whole derivation:
    Overlays for both bun 1.4.0 and opencode 2.0.15

    overlays = [
    # Each overlay is a function that takes two arguments: final and prev
    (final: prev: {
    # Override an existing package
    bun = let
    sources = {
    "aarch64-darwin" = prev.fetchurl {
    url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-darwin-aarch64.zip";
    hash = "sha256-xmnpf2Fk4cluBwF0jbmN+ndJKQjL2DlMdVcTSnNd44E=";
    };
    "aarch64-linux" = prev.fetchurl {
    url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-aarch64.zip";
    hash = "sha256-SxozLuhhmD65O8/m93D/+U4+MbLDiL2uo8jtNeWO7Q4=";
    };
    "x86_64-linux" = prev.fetchurl {
    url = "https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64-baseline.zip";
    hash = "sha256-GE+0WV8NQBohfPfHjBvEMLqDMU2reouUgFurv3+nCX8=";
    };
    };
    in
    prev.bun.overrideAttrs {
    version = "1.4.0";
    src = sources.${prev.stdenvNoCC.hostPlatform.system};
    passthru.sources = sources;
    };

      opencode = prev.opencode.overrideAttrs (finalAttrs: prevAttrs: {
        version = "2.0.15";
        src = pkgs.fetchFromGitHub {
          owner = "anomalyco";
          repo = "opencode";
          tag = "v${finalAttrs.version}";
          hash = "sha256-G4qRDwJ6i5SpsiHoej31HRPLOHpkLc66B+UmdzOY1+o=";
        };
        passthru.node_modules = prevAttrs.passthru.node_modules.overrideAttrs {
          outputHash = "sha256-d3/tMh6B+econOcX+5orEsy3aVXmfnptaR76UAyNn48=";
        };
      });
    })
    

    ];

    Nice overlay! Honestly, I just went with the binary route to avoid source-build headaches. Dealing with node_modules hashes and updating build dependencies across major versions can get pretty tedious, so grabbing the prebuilt binary just saves a ton of friction.

  11. opencode-agent commented on Oct 1, 2026

    @opencode-agent
    Contributor

    This crash affected downstream builds compiled with newer Bun 1.4 versions and code splitting enabled. OpenCode’s release build remained pinned to Bun 1.3.14. The newer bundler ordering exposed a runtime import cycle between filesystem.ts and filesystem/search.ts, leaving a layer dependency undefined before a provider request.

    We removed that cycle in #50439. The source fix shipped in v1.18.32; downstream packages need to be rebuilt from v1.18.32 or later to include it. We’re closing this report as fixed. If a build from that source still produces the same stack, please share its Bun build version and relevant log.

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