[BUG] Agents and commands broken on nixos
Resolved 💬 18 comments Opened Aug 1, 2025 by commandodev Closed Jan 8, 2026
💡 Likely answer: A maintainer (ant-kurt, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.65
- Operating System: NixOs
- Terminal: all
Bug Description
Neither the nix packaged, nor npm installed claude-code work with agents or commands on nixos. There was a point in the past where commands worked but agents have not worked for me ever.
I've tried: the claude in nixpkgs, my own version copying the nix package and updating the version and removing both of those completley and using npm install -g
I hopped over to a ubuntu machine and used the npm install -g method and it was fine
Steps to Reproduce
- Self flagelate a nixos machine into existence
- Create an agent:
❯ head ~/.claude/agents/nix-packaging-expert.md
---
name: nix-packaging-expert
description: Use this agent when you need help with Nix packaging, NixOS module development, or Nix ecosystem expertise. Examples: <example>Context: User wants to package a Python application for Nix. user: 'I need to create a Nix package for my FastAPI application with specific dependencies' assistant: 'I'll use the nix-packaging-expert agent to help you create a proper Nix derivation for your FastAPI application' <commentary>The user needs Nix packaging expertise, so use the nix-packaging-expert agent to provide specialized guidance on creating derivations, handling dependencies, and following Nix best practices.</commentary></example> <example>Context: User is configuring NixOS and needs a custom module. user: 'How do I create a NixOS module for my custom service that manages configuration files and systemd units?' assistant: 'Let me use the nix-packaging-expert agent to guide you through creating a proper NixOS module' <commentary>This requires NixOS module development expertise, so the nix-packaging-expert agent should handle this specialized task.</commentary></example>
color: purple
---
You are a Nix and NixOS expert with deep expertise in packaging software and creating robust NixOS modules. You excel at translating complex software requirements into clean, maintainable Nix expressions that follow ecosystem best practices.
Your core competencies include:
- Creating derivations for various programming languages and build systems
- Watch it not work:
> Use the nix-packaging-agent sub agent
● I'll use the nix-packaging-agent to evaluate your flake file.
● nix-packaging-agent(Evaluate NixOS flake)
⎿ Initializing…
⎿ Error: Agent type 'nix-packaging-agent' not found. Available agents:
general-purpose
╭────────────────────────────────────────────────────────────────────────────────╮
│ Agents │
│ No agents found │
│ │
│ ❯ Create new agent │
│ │
│ No agents found. Create specialized subagents that Claude can delegate to. │
│ Each subagent has its own context window, custom system prompt, and specific │
│ tools. │
│ Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or │
│ UX Reviewer. │
│ │
│ │
│ Built-in (always available): ││ general-purpose · sonnet │
│ │
╰────────────────────────────────────────────────────────────────────────────────╯
## Expected Behavior
I'd expect the agent to work, or at least get some debug logs
## Actual Behavior
Not working at all on nix
18 Comments
Found 2 possible duplicate issues:
If your issue is a duplicate, please close it and 👍 the existing issue instead.
🤖 Generated with Claude Code
The plot thickens slightly...
This still works on ubuntu
But it doesn't work on nixos.
If anyone can give me an idea what that /agents command is doing under the surface I'd be happy to help debug! I assume whatever is being executed assumes a certain filesystem which might explain why it's broken on nixos and the reports of the same on windows.
@commandodev try
This is my log, I have one global agent:
expected access directory:
"/home/$HOME/.claude/agents"
Thanks @osv I'll give that a go. Is yours working?
well well well:
Somehow I've got color codes in the filenames that are being looked up
From claude:
The issue appears to be a bug in Claude itself where ANSI color codes are
getting mixed into file paths during the /agents command execution.
Looking at your config:
configurations
This is definitely a Claude bug where it's trying to colorize the output
for display but then using those colorized strings (with embedded ANSI
codes) as actual file paths for system calls.
Workarounds to try:
NO_COLOR=1 claude
TERM=xterm claude
claude config
env -i PATH="$PATH" HOME="$HOME" TERM=dumb claude
When I run like this
/agentsworks as expectedLol, weird issue. I'm running claude from npm on Nixos,
node js: v22.14.0
claude: 1.0.67
Terminal ghostty works:
echo $TERM
xterm-ghostty
Usually I'm using urxvt - rxvt-unicode-256color
I found the fix finally!
Tracked it down to a ripgrep config that has
--color=always. I changes this tocolor=autoand it now works fine.I'm still finding it broken on NixOS, and I dont use rg.
The paths appearing from strace are correct.
It isn't working for me through the NixPkgs version, i.e.
nix run github:NixOS/nixpkgs/nixos-unstable#claude-code --impure:or via Pnpm (v1.0.65 / Node 22)
Debug logs show nothing.
Running with
NO_COLOR etc changes nothing (given that the paths are already correct).
The agents were generated by claude, but I've also tried copy/pasting some working known examples off the netw ith no dice
@rorychatterton , @commandodev btw, I'm not sure if this can help you, but you can check in your bash/zsh init for $CLAUDECODE and skip
--color=always(maybe you have alias?) Below is what I'm using to makedirenvworks in claude code "bash" tool:You can review your zsh/bash setup for ripgrep? or set NO_COLOR if $CLAUDECODE is defined?
@osv Thanks OSV, I don't use RG (Although now I have RG FOMO and will need to install it). I've confirmed it isn't referenced in my configuration, and running
env -i PATH="$PATH" HOME="$HOME" TERM=dumb claudedoesn't work.I tried your envextra (along with creating direnv.toml), but still having the same issue.
<img width="726" height="598" alt="Image" src="https://github.com/user-attachments/assets/56b7fdb5-9da5-42c4-9fc4-0ed0d9dc6453" />
Unsure whether to create another thread as the OPs original issue seems solved, but I'm having the same symptoms, albeit seemingly different cause.
Still broken in 1.0.72.
Here's one more case things could fail. For me, Claude Code is trying to execve
~/.claude/local/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/x64-freebsd/rg, which does not exist.We don't currently ship built-in ripgrep for platforms besides darwin, linux, and win32. You should be able to work around this by installing
ripgrepyourself and passing env varUSE_BUILTIN_RIPGREP=0to claude.@jxy ~That was it for me! As my installation didn't have ripgrep installed at all, the Agents was silently failing. By adding Ripgrep, the
USE_BUILTIN_RIPGREP=0variable &color=auto, agents are now working for me on Nix. Ripgrep may need to be added as a dependency to the CC Nix Package.~Edit: Actually, I just checked the ripgrep that's included with the package in the /vendor npm folder, and it works fine (I assume it's statically bound?) when calling it directly.
I've removed ripgrep entirely from my nixos config, and that env variable, and its now working for me. Must have been sorted by a recent update.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.