{"record":{"id":"aad9840d549d3399","repo":"larksuite/cli","slug":"segment-q-traverses-non-object-shape-aad984","errorCode":null,"errorMessage":"segment %q traverses non-object shape","messagePattern":"segment %q traverses non-object shape","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_data.go","lineNumber":400,"sourceCode":"\t\tif len(parts) == 1 {\n\t\t\treturn mutate(field)\n\t\t}\n\t\tswitch nested := field.Shape.(type) {\n\t\tcase typedObjectShape:\n\t\t\terr := mutateObjectField(&nested, parts[1:], mutate)\n\t\t\tfield.Shape = nested\n\t\t\treturn err\n\t\tcase typedOneOfShape:\n\t\t\tfor variantIndex, variant := range nested.Variants {\n\t\t\t\tif nestedObject, ok := variant.(typedObjectShape); ok {\n\t\t\t\t\terr := mutateObjectField(&nestedObject, parts[1:], mutate)\n\t\t\t\t\tnested.Variants[variantIndex] = nestedObject\n\t\t\t\t\tfield.Shape = nested\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"segment %q traverses non-object shape\", name)\n\t}\n\treturn fmt.Errorf(\"field %q does not exist\", name)\n}\n\nfunc pointerFloats(values ...*float64) []float64 {\n\tresult := make([]float64, 0, len(values))\n\tfor _, value := range values {\n\t\tif value != nil {\n\t\t\tresult = append(result, *value)\n\t\t}\n\t}\n\treturn result\n}\n\nfunc shapeHasConstraints(shape typedValueShape) bool {\n\tswitch value := shape.(type) {\n\tcase typedStringShape:\n\t\treturn len(value.Enum) > 0 || value.Format != \"\" || value.MinLength != nil || value.MaxLength != nil","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_data.go#L382-L418","documentation":"mutateObjectField walks a JSON-pointer path segment by segment to reach the field a DataField override targets. When an intermediate segment names a field whose shape is neither an object nor a oneOf-with-object-variants shape (e.g. a string, array, or scalar), traversal cannot continue and the compiler throws this error. It means the override path descends through a non-object field.","triggerScenarios":"CompileCommandDefinition with Output.Data.Overrides[i].Path such as \"/items/0/name\" or \"/tags/inner\" where \"items\" or \"tags\" is an array, string, number, or other non-object/non-oneOf shape, so a middle pointer segment cannot be traversed.","commonSituations":"Hand-writing a JSON pointer against the Go data struct and mistaking an array-of-objects for an object; the data model changed a nested struct into a slice or scalar while overrides still used the old deep path.","solutions":["Fix the override Path so every intermediate segment names an object-typed (or oneOf-of-objects) field.","If the intermediate field is an array, target the array field itself (e.g. \"/items\") instead of descending into it.","Update the override after a data-model refactor that turned the nested struct into a scalar or slice."],"exampleFix":"// before\ncommon.TypedDataField{Path: \"/owner/name\", Description: \"Owner\"} // owner is a string\n// after\ncommon.TypedDataField{Path: \"/owner\", Description: \"Owner name\"}","handlingStrategy":"validation","validationCode":"func pathTraversesObjects(path string, root map[string]common.TypedValueField) error {\n  parts := strings.Split(strings.TrimPrefix(path, \"/\"), \"/\")\n  cur := root\n  for _, p := range parts[:len(parts)-1] {\n    f, ok := cur[p]\n    if !ok { return fmt.Errorf(\"missing %q\", p) }\n    obj, ok := f.Shape.(common.TypedObjectShape)\n    if !ok { return fmt.Errorf(\"segment %q is not an object\", p) }\n    cur = fieldMap(obj)\n  }\n  _, ok := cur[parts[len(parts)-1]]\n  if !ok { return fmt.Errorf(\"leaf %q missing\", parts[len(parts)-1]) }\n  return nil\n}","typeGuard":"func isObjectShape(s common.TypedValueShape) bool { _, ok := s.(common.TypedObjectShape); return ok }","tryCatchPattern":null,"preventionTips":["Derive override paths from the actual struct layout, not from memory.","Remember arrays and scalars cannot be traversed; stop the pointer at the array/scalar field.","Re-check paths after any nested struct is refactored into a slice or value type."],"tags":["json-pointer","schema","compile-time"],"backgroundTag":"invalid-json-pointer-path","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}