Skip to content

bash commands does not work #185

Description

@leonardorpaixao

Describe the bug

Tool: GitHub Copilot CLI
- Erro: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
- Contexto: trying to use bash tool with sessionId
- OS: Darwin (macOS)

Affected version

0.0.332

Steps to reproduce the behavior

just ask for a command including bash.

Expected behavior

Execute the command properly.

Additional context

No response

Activity

  1. lostintangent commented on Oct 3, 2025

    @lostintangent
    Member

    Hey! 👋🏼 Could you share a specific prompt that you run into this error? I'm also using macOS, and I just tried, but wasn't able to repro it.

  2. desktophero commented on Oct 4, 2025

    @desktophero

    I'm experiencing this issue so sharing similar outputs.

    First, local install details:

    copilot --version
    0.0.333
    Commit: 4cbf3da

    Running on macOS

    my prompt:

    setup dependabot to check for updates to npm packages defined in a new folder called copilot-components. Add a package.json to this new folder. Add dependabot yaml to .github folder and have dependabot scan for package updates across all of the package.json/lock files in the repo. create the necessary files and folders

     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     ✗ Create copilot-components directory
       $ cd /Users/desktophero/code/temp/github-copilot-adoption && mkdir -p copilot-components && echo "Directory created"
       The "path" argument must be of type string. Received undefined
    
     Operation cancelled by user
    

    I hit esc to stop the loop above.

    I then just asked copilot to create the folder, no other detail:

    prompt: create a folder called copilot-components

    I apologize for the technical difficulties with the bash tool. It seems there's
       an issue with the tool configuration. Let me create a workaround by creating a
       placeholder file in the copilot-components directory, which will create the
       directory automatically:
    
     ✗ Create copilot-components/.gitkeep
       Parent directory does not exist
    
     ● I understand the issue - the str_replace_editor tool cannot create parent
       directories. Since the bash tool seems to have a configuration issue, could you
       please manually create the copilot-components folder in your terminal? You can
       run:
    
         mkdir copilot-components
    
       Once the folder is created, I can then add the package.json file to it.
       Alternatively, if you have already created the folder, please let me know and
       I'll proceed with creating the package.json file.
    
       In the meantime, I've successfully created the Dependabot configuration file at
       .github/dependabot.yml with daily checks for both the root directory and the
       copilot-components directory. Would you like me to show you the contents of that
       file?
    

    I then asked copilot, how do I fix this issue?

    prompt: how do I fix the configuration of the bash tool?

     ● The bash tool configuration issue appears to be related to missing working
       directory setup. Let me try a simpler approach without changing directories:
    
     ✗ Test bash and create directory
       $ pwd
       The "path" argument must be of type string. Received undefined
    

    I put copilot into debug mode and see this output in the tool_calls output:

    new cli startup:

    copilot --log-dir ~/copilot-logs --log-level debug

    {
          "finish_reason": "tool_calls",
          "message": {
            "role": "assistant",
            "tool_calls": [
              {
                "function": {
                  "arguments": "{\"async\":false,\"command\":\"pwd \\u0026\\u0026 ls -la\",\"description\":\"Show current directory and list files\",\"sessionId\":\"main\"}",
                  "name": "bash"
                },
                "id": "tooluse_CNjdLsLOTjG9WNJaWt7qMg",
                "type": "function"
              }
            ]
          }

    Perhaps the unicode "&" is affecting this is some way?

    I then asked copilot to use bash to view the pwd

    prompt: use the bash tool to view the pwd

     ✗ Show current working directory
       $ pwd
       The "path" argument must be of type string. Received undefined
    

    Debug log:

    {
          "finish_reason": "tool_calls",
          "message": {
            "role": "assistant",
            "tool_calls": [
              {
                "function": {
                  "arguments": "{\"async\":false,\"command\":\"pwd\",\"description\":\"Show current working directory\",\"sessionId\":\"main\"}",
                  "name": "bash"
                },
                "id": "tooluse_qXeEsiEKT5-Kx-xbILEOUQ",
                "type": "function"
              }
            ]
          }

    I didn't see any unicode here in the command value above but similar error is raised.

    I then restarted copilot with copilot --log-dir ~/copilot-logs --log-level debug --allow-all-tools and ran the pwd prompt above again:

    ● I'll run the pwd command to show the current working directory.
    
     ✗ Show current working directory
       $ pwd
       The "path" argument must be of type string. Received undefined
    
     ● Let me try again with the bash command:
    
     ✗ Show current working directory
       $ pwd
       The "path" argument must be of type string. Received undefined
    
     ● Let me try a different approach with the bash tool:
    
     ✗ Show current working directory
       $ pwd
       The "path" argument must be of type string. Received undefined

    similar output in JSON log

    {
          "finish_reason": "tool_calls",
          "message": {
            "role": "assistant",
            "tool_calls": [
              {
                "function": {
                  "arguments": "{\"async\":false,\"command\":\"pwd\",\"description\":\"Show current working directory\",\"sessionId\":\"pwd-session\"}",
                  "name": "bash"
                },
                "id": "tooluse_vy8pr9bKR0meRnIGZvXlPA",
                "type": "function"
              }
            ]
          }
  3. Eastonco commented on Oct 5, 2025

    @Eastonco

    @desktophero @leonardorpaixao Have you verified you're using Node v22+? I was having the same issue when running on v18

    Also duplicate of #180

  4. leonardorpaixao commented on Oct 5, 2025

    @leonardorpaixao
    Author

    @Eastonco I was using the version that metion, but even after updating the version to 22, the problem is still there.

  5. desktophero commented on Oct 5, 2025

    @desktophero

    I thought I was on Node 22 but was on Node 20. Updated to Node 22 and ran the steps I reported above. After the update to Node 22, no more issues. Thank you, @Eastonco!

  6. jcchavezs commented on Oct 13, 2025

    @jcchavezs

    I can confirm it was solved after upgrading to node22

  7. EvanBoyle commented on Nov 6, 2025

    @EvanBoyle
    Collaborator

    We're now enforcing a node version check. So closing this issue out.

  8. andresgutgon commented on Nov 15, 2025

    @andresgutgon

    Still having this issue

    ❯ copilot --version
    0.0.354
    Commit: 076bd172b
    ❯ node -v
    v22.14.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions