Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Claude loads my projects .env into its bash environment (!) #401

Open
1 of 4 tasks
rasmuscnielsen opened this issue Mar 8, 2025 · 0 comments
Open
1 of 4 tasks
Labels
bug Something isn't working

Comments

@rasmuscnielsen
Copy link

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version: 0.2.35 (Claude Code)
  • Operating System: macOS 15.3.1
  • Terminal: Warp

Bug Description

For the life of me I couldn't figure out why Claude running my Laravel test suite was dropping my local development database every time. During testing, it should rather be using the test environment database for running migrations.

Then after a lot of digging I realized asking Claude to dump its env, it had loaded my projects .env file into its bash env. This causes Laravel to completely ignore whatever I have written in my .env file or any phpunit.xml.

Is it just me or does this seem like a massive issue? Big fan of Claude here and been using the CLI a ton. But I was under the impression that it was quite transparent in what It was doing, but somehow loading my .env wasn't on the list of things I was expecting 🤔

Steps to Reproduce

  1. Create an empty folder and create a .env file with the contents 'MY_SECRET_ENV=test'
  2. Open terminal, navigate to the folder and run claude
  3. Ask Claude to run env. Now you should see 'MY_SECRET_ENV=test ' listed in the output. This will not happen when you just type env in your own bash terminal.

Expected Behavior

Claude should not load my projects .env in its bash environment

Actual Behavior

See above.

@rasmuscnielsen rasmuscnielsen added the bug Something isn't working label Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant