larksuite/cli · error
field %q does not exist
Error message
field %q does not exist
What it means
mutateObjectField could not find a field matching the first (or next) segment of the override's JSON-pointer path in the compiled object shape, so it reports the field does not exist. The DataField override therefore references a field that the compiled data struct does not declare.
Source
Thrown at shortcuts/common/typed_compile_data.go:402
}
switch nested := field.Shape.(type) {
case typedObjectShape:
err := mutateObjectField(&nested, parts[1:], mutate)
field.Shape = nested
return err
case typedOneOfShape:
for variantIndex, variant := range nested.Variants {
if nestedObject, ok := variant.(typedObjectShape); ok {
err := mutateObjectField(&nestedObject, parts[1:], mutate)
nested.Variants[variantIndex] = nestedObject
field.Shape = nested
return err
}
}
}
return fmt.Errorf("segment %q traverses non-object shape", name)
}
return fmt.Errorf("field %q does not exist", name)
}
func pointerFloats(values ...*float64) []float64 {
result := make([]float64, 0, len(values))
for _, value := range values {
if value != nil {
result = append(result, *value)
}
}
return result
}
func shapeHasConstraints(shape typedValueShape) bool {
switch value := shape.(type) {
case typedStringShape:
return len(value.Enum) > 0 || value.Format != "" || value.MinLength != nil || value.MaxLength != nil
case typedBooleanShape:
return len(value.Enum) > 0View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Correct the Path to exactly match the field name declared on the Go data struct (names are case-sensitive).
- Run the schema/dry-run output for the command to inspect the compiled data shape and copy the exact field names.
- Remove the override if the field no longer exists after a model change.
- Check nested paths: each segment must exist at its own level (parent object first).
Example fix
// before
common.TypedDataField{Path: "/desc", Description: "..."} // field is "description"
// after
common.TypedDataField{Path: "/description", Description: "..."} Defensive patterns
Strategy: validation
Validate before calling
func validateOverridePaths(paths []string, root map[string]common.TypedValueField) error {
for _, path := range paths {
parts := strings.Split(strings.TrimPrefix(path, "/"), "/")
cur := root
for i, p := range parts {
f, ok := cur[p]
if !ok { return fmt.Errorf("override %q: %q does not exist", path, p) }
if i < len(parts)-1 {
if obj, ok := f.Shape.(common.TypedObjectShape); ok { cur = fieldMap(obj) } else { break }
}
}
}
return nil
} Prevention
- Copy field names from the compiled schema output instead of typing them.
- Watch for renames/removals of struct fields; search the codebase for override paths referencing them.
- Escape '~' as '~0' and '/' as '~1' in pointer segments per RFC 6901.
When it happens
Trigger: CompileCommandDefinition with Output.Data.Overrides[i].Path whose segment (e.g. "/statuz" or "/meta/renamedField") does not match any Field name of the object shape at that level; also raised for nested segments when the parent object exists but lacks the child.
Common situations: Typo in the pointer path; case mismatch (matching is exact); the doc-declared struct field was renamed or removed while overrides still reference the old name; forgetting JSON-pointer escaping for keys containing '~' or '/'.
Related errors
- segment %q traverses non-object shape
- json.RawMessage requires an explicit Shape
- Shape conflicts with schema constraints
- lark-cli returned a non-object JSON payload
- expected boolean
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/e079460c010297f4.
Report an issue: GitHub.