Skip to content

[BUG] CLAUDE_ENV_FILE not sourced on resumed sessions (--continue) #12418

Closed as duplicate

Description

@ww2283

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When using claude --continue or claude --resume, the CLAUDE_ENV_FILE written by SessionStart hooks is not
sourced, even though the hooks run successfully.

What Should Happen?

Environment variables written to CLAUDE_ENV_FILE during SessionStart hooks should be available in subsequent Bash
commands, regardless of whether the session is fresh or resumed.

  • Fresh session: CLAUDE_ENV_FILE is sourced correctly ✓
  • Resumed session: Hook runs, writes to file, but variables NOT available ✗

Error Messages/Logs

Steps to Reproduce

  1. Create SessionStart hook writing to CLAUDE_ENV_FILE
  2. Fresh start: claude → echo $TEST_VAR → works
  3. Resume: claude --continue → echo $TEST_VAR → empty

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.0.52

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Use Case

Loading .envrc (direnv) at session start. Users use --continue for context but lose environment.

Activity

  1. github-actions commented on Nov 26, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] SessionStart hook doesn't receive CLAUDE_ENV_FILE when installed by a plugin #11649
    2. [BUG] SessionStart hooks never execute for local file-based marketplace plugins #11509
    3. [BUG] Plugin hook output not captured or passed to agent (UserPromptSubmit, SessionStart) #12151

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. added
    duplicateThis issue or pull request already exists
    and removed
    bugSomething isn't working
    has reproHas detailed reproduction steps
    platform:macosIssue specifically occurs on macOS
    on Nov 29, 2025
  3. github-actions commented on Nov 29, 2025

    @github-actions

    This issue has been automatically closed as a duplicate of #11649.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  4. github-actions commented on Dec 6, 2025

    @github-actions

    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.

  5. locked as resolved and limited conversation to collaborators on Dec 6, 2025
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

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions