{"record":{"id":"8218b3835bae1592","repo":"direnv/direnv","slug":"envrc-not-found","errorCode":null,"errorMessage":".envrc not found","messagePattern":"\\.envrc not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/cmd_reload.go","lineNumber":17,"sourceCode":"package cmd\n\nimport (\n\t\"fmt\"\n)\n\n// CmdReload is `direnv reload`\nvar CmdReload = &Cmd{\n\tName: \"reload\",\n\tDesc: \"Triggers an env reload\",\n\tAction: actionWithConfig(func(_ Env, _ []string, config *Config) error {\n\t\tfoundRC, err := config.FindRC()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif foundRC == nil {\n\t\t\treturn fmt.Errorf(\".envrc not found\")\n\t\t}\n\n\t\tif foundRC.Allowed() == Denied {\n\t\t\treturn fmt.Errorf(notAllowed, foundRC.Path())\n\t\t}\n\n\t\treturn foundRC.Touch()\n\t}),\n}\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/direnv/direnv/blob/b00e451f547f39be7ab836d969054114a465a0f9/internal/cmd/cmd_reload.go#L1-L27","documentation":"`direnv reload` re-runs the .envrc for the current directory. Before doing so it calls config.FindRC(); if no .envrc (or .env) can be located in the current directory or its ancestors, direnv returns '.envrc not found' since there is nothing to reload.","triggerScenarios":"Running `direnv reload` in a directory with no .envrc/.env file anywhere up the tree, or while cwd is outside the project, or the RC file was deleted/renamed.","commonSituations":"Running reload from a subdirectory after moving the .envrc, forgetting to create the .envrc initially, typos in the filename (.envrrc, envrc), or running from a temp/other directory in a terminal.","solutions":["cd to the project directory that contains the .envrc (or a subdirectory of it)","Create the file: `echo 'PATH=$PWD/bin' > .envrc && direnv allow`","Check the filename spelling is exactly `.envrc`","Verify with `direnv status` which RC file direnv expects for the current directory"],"exampleFix":"// before\ncd /tmp && direnv reload   # no .envrc here\n// after\ncd ~/myproject && direnv reload","handlingStrategy":"validation","validationCode":"[ -f .envrc ] || { echo \"no .envrc in $(pwd)\" >&2; exit 1; }\ndirenv reload","typeGuard":null,"tryCatchPattern":"if ! direnv reload 2>&1 | grep -q '.envrc not found'; then :; else echo \"cd to your project first\" >&2; fi","preventionTips":["Run direnv commands from the project root or a subdirectory of it","Create .envrc before relying on reload: touch .envrc && direnv allow","Confirm the expected RC with `direnv status`"],"tags":["cli","envrc","file-not-found"],"backgroundTag":"envrc-not-found","analyzedSha":"b00e451f547f39be7ab836d969054114a465a0f9","analyzedAt":"2026-09-05T21:39:49.983Z","contentChangedAt":"2026-09-05T21:39:49.983Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}