{"record":{"id":"03002107e0571c77","repo":"dagger/dagger","slug":"evaluate-env-file-w","errorCode":null,"errorMessage":"Evaluate env file: %w","messagePattern":"Evaluate env file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/envfile.go","lineNumber":181,"sourceCode":"\n// Filters variables by prefix and removes the prefix from keys.\n//\n// Variables without the prefix are excluded. For example, with the prefix\n// \"MY_APP_\" and variables:\n//\n//\tMY_APP_TOKEN=topsecret\n//\tMY_APP_NAME=hello\n//\tFOO=bar\n//\n// the resulting environment will contain:\n//\n//\tTOKEN=topsecret\n//\tNAME=hello\nfunc (ef *EnvFile) Namespace(ctx context.Context, prefix string) (*EnvFile, error) {\n\t// use raw variables here given that they'll get expanded later when used\n\tvars, err := ef.Variables(ctx, true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Evaluate env file: %w\", err)\n\t}\n\tresult := &EnvFile{\n\t\tExpand: ef.Expand,\n\t\t// Preserve any hidden expansion context already carried by the source.\n\t\tContext: slices.Clone(ef.Context),\n\t}\n\tfor _, variable := range vars {\n\t\tif after, match := cutFlexPrefix(variable.Name, prefix); match {\n\t\t\tresult.add(after, variable.Value)\n\t\t} else {\n\t\t\t// Keep non-matching variables as hidden expansion context so that\n\t\t\t// namespaced values referencing them (e.g. SOURCE=${ROOT_DIR}) can\n\t\t\t// still be expanded later. They are not exposed as defaults.\n\t\t\tresult.Context = append(result.Context, variable.Name+\"=\"+variable.Value)\n\t\t}\n\t}\n\treturn result, nil\n}","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/envfile.go#L163-L199","documentation":"Wrapper in EnvFile.Namespace: the underlying evaluation of the env file's variables (expansion of references via ef.Variables) failed, so a namespaced subset cannot be produced. The wrapped cause names the specific variable or parse problem.","triggerScenarios":"Thrown at core/envfile.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the variable error reported in the wrapped cause (undefined reference, cycle, or parse error)","Validate the .env file contents before re-running the namespace operation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}