đ§ Troubleshooting
Solutions to common development container issues and errors
â Error: "Cannot connect to Docker daemon"
Cause: Docker Desktop isn't running.
Solution:
- Start Docker Desktop from your Applications folder
- Wait for the whale icon in your menu bar/system tray to show it's running
- Retry in VS Code: Cmd+Shift+P â "Dev Containers: Rebuild Container"
â Error: "Command not found" (npm, python, etc.)
Cause: Tool not installed in the container, or PATH not set correctly.
Solution:
-
Check your Dockerfile has the correct base image (e.g.,
FROM node:22) - Rebuild the container: Cmd+Shift+P â "Dev Containers: Rebuild Container"
- If still failing, check you're using the correct terminal (should say "Dev Container" in bottom-left)
â ī¸ Container is very slow
Cause: Docker performance issues, especially on Mac/Windows.
Solutions:
- Mac: Enable VirtioFS in Docker Desktop â Settings â Experimental Features
- Windows: Ensure project is in WSL2 filesystem, not /mnt/c/
-
Use named volumes for node_modules: Add to mounts:
"source=node-modules,target=/workspace/node_modules,type=volume" - Create .dockerignore file to exclude node_modules, .git from build context
âšī¸ Port already in use
Cause: Another process is using the port (e.g., 3000, 5000).
Solutions:
-
Find what's using the port:
lsof -i :3000(Mac/Linux) ornetstat -ano | findstr :3000(Windows) - Kill the process or change your app's port
- Update forwardPorts in devcontainer.json to match new port
â Codex CLI: Landlock Sandbox Error
thread 'main' panicked at linux-sandbox/src/linux_run_main.rs:30:9:
error running landlock: Sandbox(LandlockRestrict)
Cause: Docker's LinuxKit kernel doesn't support Landlock (Linux security module). This is a known limitation of containerized environments.
Solution: Disable Codex sandboxing (safe in containers):
~/.codex/config.toml
sandbox_mode = "danger-full-access"
approval_policy = "never"
â Why This Is Safe:
- Docker container provides process isolation
- Network firewall restricts connections
- Non-root user execution (node)
- OpenAI's official recommendation for Docker
Verify it works:
codex --version
codex exec "echo 'Hello from Codex'"
đ Note: This repository's devcontainer
automatically applies this fix via
init-codex-config.sh. Configuration persists
across container rebuilds.
â ī¸ IMPORTANT: VSCode Extension Limitation
The above configuration only works for Codex CLI, not the VSCode extension.
VSCode Extension Issue:
-
Extension ignores
sandbox_modein config.toml -
Only reads
modelandmodel_reasoning_effort - Always tries to use Landlock sandbox (fails in Docker)
- Tracked as GitHub Issue #5041
â Workaround:
Use Codex CLI instead of VSCode extension:
codex exec "your prompt here"
Status: OpenAI is working on adding config.toml support to the extension. No ETA available. CLI works perfectly.
â OpenCode: TUI Crashes When Loading Models
TypeError: undefined is not an object (evaluating 'flat().length')
at <anonymous> (src/cli/cmd/tui/ui/dialog-select.tsx:49:49)
Cause: OpenCode's auth.json contains provider configurations incompatible with AI SDK v5. The cloudflare-workers-ai provider doesn't support specification v2 required by SDK v5, and expired OAuth tokens (github-copilot) return undefined when queried, causing the dialog component to crash when attempting to flatten provider data.
Solution:
1. Backup current configuration
cp ~/.local/share/opencode/auth.json \
~/.local/share/opencode/auth.json.backup
2. Remove incompatible providers from auth.json
nano ~/.local/share/opencode/auth.json
Keep only: anthropic, openrouter, nvidia, openai, google
3. Clear stale cache
rm -rf ~/.cache/opencode/*
4. Verify operation
opencode models # Should display 180+ models
opencode # TUI should start without errors
đĄ Why This Works
- Removes provider entries that return undefined when queried
- Clears cached model metadata referencing removed providers
- Allows OpenCode to rebuild provider list from scratch
â Compatible Providers
- anthropic, openai, google (primary providers)
- openrouter, nvidia (third-party aggregators)
â Known Incompatible Providers
- cloudflare-workers-ai (doesn't support AI SDK v5)
- requesty (similar SDK incompatibility - Issue #2468)
- github-copilot (OAuth flow incompatible with devcontainers)
đ§ Prevention Tips
- Only authenticate with actively maintained providers
- Periodically review auth.json and remove unused/expired providers
-
Keep OpenCode updated:
npm update -g @opencode-ai/opencode
â Docker Build: Permission Denied in .config Directory
mkdir: cannot create directory '/home/node/.config/fish': Permission denied
ERROR: command failed: mkdir -p /home/node/.config/fish
Cause: Setting ownership on a subdirectory
(like .config/gh) instead of the parent directory
(.config) leaves the parent owned by root. When
installers (uv, fish, zsh) try to create their own
subdirectories, they fail due to permission errors.
Root Cause Explanation:
-
mkdir -p /home/node/.config/ghcreates both parent and subdirectory -
Parent directory
.configis owned by root -
chownon subdirectory only affects that subdirectory - Later installers cannot create new subdirectories in root-owned parent
â Incorrect (in Dockerfile):
RUN mkdir -p /home/node/.config/gh /home/node/.claude && \
chown -R node:node /home/node/.config/gh # Only owns subdirectory!
â Correct (in Dockerfile):
RUN mkdir -p /home/node/.config/gh /home/node/.claude && \
chown -R node:node /home/node/.config # Owns entire .config tree!
đĄ Pattern to remember:
-
â
chown -R user /path/parent/child(only owns child) -
â
chown -R user /path/parent(owns parent + all children)
Verification commands:
# Check parent directory ownership
ls -ld /home/node/.config
# Should show: drwxr-xr-x node node
# Test creating new subdirectory as node user
su - node -c "mkdir -p /home/node/.config/test"
# Should succeed without permission errors
â ī¸ When you see this: Permission errors
during RUN commands that create files in
~/.config, installers like uv/fish/zsh failing,
or build succeeding up to a point then failing on config
directory creation.
đĄ Quick Debug Commands
# Check Docker is running
docker ps
# Check container logs
docker logs <container-name>
# View Docker disk usage
docker system df
# Clean up unused images/containers (frees space)
docker system prune -a
# Restart Docker Desktop
# Mac: Click whale icon â Quit â Relaunch
# Windows: Right-click whale icon â Quit â Relaunch