{"record":{"id":"2acdf78f08619ee8","repo":"mikefarah/yq","slug":"failed-to-load-v-w","errorCode":null,"errorMessage":"failed to load %v: %w","messagePattern":"failed to load (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_load.go","lineNumber":88,"sourceCode":"\tvar results = list.New()\n\n\tfor el := context.MatchingNodes.Front(); el != nil; el = el.Next() {\n\t\tcandidate := el.Value.(*CandidateNode)\n\n\t\trhs, err := d.GetMatchingNodes(context.SingleReadonlyChildContext(candidate), expressionNode.RHS)\n\t\tif err != nil {\n\t\t\treturn Context{}, err\n\t\t}\n\t\tif rhs.MatchingNodes.Front() == nil {\n\t\t\treturn Context{}, fmt.Errorf(\"filename expression returned nil\")\n\t\t}\n\t\tnameCandidateNode := rhs.MatchingNodes.Front().Value.(*CandidateNode)\n\n\t\tfilename := nameCandidateNode.Value\n\n\t\tcontentsCandidate, err := loadString(filename)\n\t\tif err != nil {\n\t\t\treturn Context{}, fmt.Errorf(\"failed to load %v: %w\", filename, err)\n\t\t}\n\n\t\tresults.PushBack(contentsCandidate)\n\n\t}\n\n\treturn context.ChildContext(results), nil\n}\n\nfunc loadOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {\n\tlog.Debugf(\"loadOperator\")\n\tif ConfiguredSecurityPreferences.DisableFileOps {\n\t\treturn Context{}, fmt.Errorf(\"file operations have been disabled\")\n\t}\n\n\tloadPrefs := expressionNode.Operation.Preferences.(loadPrefs)\n\n\t// need to evaluate the 1st parameter against the context","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_load.go#L70-L106","documentation":"loadString resolved a filename and called loadString(filename) to read it, but the read/parse of that file failed. The %w wraps the underlying cause — commonly the file does not exist, is unreadable, or its contents could not be parsed as the expected format; the offending filename is printed in the message.","triggerScenarios":"Thrown at pkg/yqlib/operator_load.go:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the printed filename exists and is readable","Correct the path — it is interpreted literally as given","Ensure the target file's content is valid for its format","Verify the process has permission to read the file"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8b5af0694bb82b41d4ae180fac9972029066f90a","analyzedAt":"2026-09-05T10:57:22.766Z","contentChangedAt":"2026-09-05T10:57:22.766Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}