{"record":{"id":"c0ff341db7939098","repo":"mikefarah/yq","slug":"delpaths-expected-entry-v-to-be-a-sequence-bu","errorCode":null,"errorMessage":"DELPATHS: expected entry [%v] to be a sequence, but its a %v. Note that delpaths takes an array of path arrays, e.g. [[\"a\", \"b\"]]","messagePattern":"DELPATHS: expected entry \\[(.+?)\\] to be a sequence, but its a (.+?)\\. Note that delpaths takes an array of path arrays, e\\.g\\. \\[\\[\"a\", \"b\"\\]\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_path.go","lineNumber":123,"sourceCode":"\tpathArraysContext, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode.RHS)\n\tif err != nil {\n\t\treturn Context{}, err\n\t}\n\tif pathArraysContext.MatchingNodes.Len() != 1 {\n\t\treturn Context{}, fmt.Errorf(\"DELPATHS: expected single value but found %v\", pathArraysContext.MatchingNodes.Len())\n\t}\n\tpathArraysNode := pathArraysContext.MatchingNodes.Front().Value.(*CandidateNode)\n\n\tif pathArraysNode.Tag != \"!!seq\" {\n\t\treturn Context{}, fmt.Errorf(\"DELPATHS: expected a sequence of sequences, but found %v\", pathArraysNode.Tag)\n\t}\n\n\tupdatedContext := context\n\n\tfor i, child := range pathArraysNode.Content {\n\n\t\tif child.Tag != \"!!seq\" {\n\t\t\treturn Context{}, fmt.Errorf(\"DELPATHS: expected entry [%v] to be a sequence, but its a %v. Note that delpaths takes an array of path arrays, e.g. [[\\\"a\\\", \\\"b\\\"]]\", i, child.Tag)\n\t\t}\n\t\tchildPath, err := getPathArrayFromNode(\"DELPATHS\", child)\n\n\t\tif err != nil {\n\t\t\treturn Context{}, err\n\t\t}\n\n\t\tchildTraversalExp := createTraversalTree(childPath, traversePreferences{}, false)\n\t\tdeleteChildOp := &Operation{OperationType: deleteChildOpType}\n\n\t\tdeleteChildOpNode := &ExpressionNode{\n\t\t\tOperation: deleteChildOp,\n\t\t\tRHS:       childTraversalExp,\n\t\t}\n\n\t\tupdatedContext, err = d.GetMatchingNodes(updatedContext, deleteChildOpNode)\n\n\t\tif err != nil {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_path.go#L105-L141","documentation":"Each element inside the array passed to `delpaths` must itself be a sequence (array of path segments). This error reports the index of the offending entry and its actual tag, and reminds you that delpaths takes an array of path arrays. It exists because a non-sequence entry cannot be converted into a path array.","triggerScenarios":"`delpaths([\"a\"])` (entry 0 is a scalar string, not an array), `delpaths([[\"a\"], \"b\"])`, or entries produced by an expression returning maps/scalars instead of path arrays.","commonSituations":"Mixing jq `delpaths([\"a\"])` shorthand with yq's stricter `[ path, ... ]` shape; building path lists dynamically where some entries are strings rather than arrays; forgetting the outer level of nesting.","solutions":["Ensure every entry is an array: change `delpaths([\"a\"])` to `delpaths([[\"a\"]])`.","Check the reported index in the message — that entry is the malformed one.","If generating paths programmatically, wrap each path in `[ ... ]` so entries are sequences.","Validate with `map(tag == \"!!seq\") | all` before passing to delpaths."],"exampleFix":"// before\nyq 'delpaths([\"a\", \"b\"])' file.yml\n// after\nyq 'delpaths([[\"a\"], [\"b\"]])' file.yml","handlingStrategy":"validation","validationCode":"yq -e 'map(tag == \"!!seq\") | all' <<< \"$paths\" || echo \"every delpaths entry must be an array\"","typeGuard":"isSeqOfSeqs() { [ \"$(yq 'map(tag == \"!!seq\") | all' <<< \"$1\")\" = \"true\" ]; }","tryCatchPattern":"out=$(yq 'delpaths($p)' file.yml 2>&1) || { echo \"$out\"; echo \"check entry at reported index — must be a path array\"; }","preventionTips":["Remember jq's delpaths([\"a\"]) shorthand is invalid in yq — wrap each path in its own array.","When building paths programmatically, wrap each path: map([.]).","Test path arrays with map(tag == \"!!seq\") | all before use.","Read the entry index from the error message to pinpoint the bad element."],"tags":["yq","delpaths","type-mismatch","path-arrays"],"backgroundTag":"delpaths-invalid-path-argument","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"}