{"record":{"id":"8f1b1c81f9f48841","repo":"weaviate/weaviate","slug":"nested-path-q-empty-sub-property-path","errorCode":null,"errorMessage":"nested path %q: empty sub-property path","messagePattern":"nested path %q: empty sub-property path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"entities/filters/nested/path.go","lineNumber":282,"sourceCode":"\t\tdt := schema.DataType(np.DataType[0])\n\t\tif seg.HasIndex {\n\t\t\tif _, ok := schema.IsArrayType(dt); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\"nested path %q: sub-property %q is of type %q — [N] indexing requires an array type\",\n\t\t\t\t\tfullPath, seg.Name, dt)\n\t\t\t}\n\t\t}\n\t\tif i == len(segs)-1 {\n\t\t\treturn np, nil\n\t\t}\n\t\tif !schema.IsNested(dt) {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"nested path %q: sub-property %q must be object or object[], got %q\",\n\t\t\t\tfullPath, seg.Name, dt)\n\t\t}\n\t\tprops = np.NestedProperties\n\t}\n\treturn nil, fmt.Errorf(\"nested path %q: empty sub-property path\", fullPath)\n}\n","sourceCodeStart":264,"sourceCodeEnd":284,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/entities/filters/nested/path.go#L264-L284","documentation":"This is walkPath's loop-exit fallback. The for-loop returns on the final segment (leaf) or errors earlier, so reaching the statement after the loop means the segments slice was empty from the start — the path had only the root segment's remainder of zero sub-segments. It is a defensive guard indicating the caller passed an effectively empty sub-path.","triggerScenarios":"Calling ResolveLeafFromRoot with a path that parses to segments such that segs[1:] passed to walkPath is empty — practically only possible via direct walkPath invocation or a degenerate/empty path string that still passes the earlier length checks.","commonSituations":"Almost exclusively seen from direct walkPath calls in tests or internal refactors; an empty path string slipping through upstream validation.","solutions":["Never call walkPath directly; use ResolveLeaf/ResolveLeafFromRoot which pre-validate segment count","Validate the path string is non-empty and contains at least root.sub before resolution","Treat this error as an internal invariant violation and log the full path for debugging"],"exampleFix":"// before — direct call with empty sub-segments\nnp, err := walkPath(rootProp.NestedProperties, nil, path)\n// after — go through the public resolver\nnp, err := nested.ResolveLeafFromRoot(rootProp, path)","handlingStrategy":"validation","validationCode":"if path == \"\" { return fmt.Errorf(\"empty nested path\") }\nsegs := nested.ParseSegments(path)\nif len(segs) == 0 { return fmt.Errorf(\"path %q parsed to zero segments\", path) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only the exported resolvers (ResolveLeaf/ResolveLeafFromRoot)","Reject empty or whitespace-only path strings early","Treat this error as an invariant violation; log full context"],"tags":["go","filters","nested-properties","internal-invariant"],"backgroundTag":"invalid-nested-path","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}