larksuite/cli · error
field %q does not exist
Error message
field %q does not exist
What it means
resolveShapeField looks up a field by decoded name inside a typedObjectShape; if no field matches, traversal fails with this error. It occurs while applying an Output.Data override or explicit Shape pointer to a struct whose compiled shape has no field with that name.
Source
Thrown at shortcuts/common/typed_compile_contract.go:150
}
var err error
current, err = resolveShapeField(current, name)
if err != nil {
return nil, err
}
}
return current, nil
}
func resolveShapeField(shape typedValueShape, name string) (typedValueShape, error) {
switch value := shape.(type) {
case typedObjectShape:
for _, field := range value.Fields {
if field.Name == name {
return field.Shape, nil
}
}
return nil, fmt.Errorf("field %q does not exist", name)
case typedOneOfShape:
var resolved []typedValueShape
for _, variant := range value.Variants {
if _, null := variant.(typedNullShape); null {
continue
}
field, err := resolveShapeField(variant, name)
if err != nil {
return nil, err
}
resolved = append(resolved, field)
}
return combineResolvedShapes(resolved)
default:
return nil, fmt.Errorf("segment %q traverses non-object shape", name)
}
}
View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Fix the field name in the override Path to match the struct's JSON field name exactly (case-sensitive).
- Check the struct's json tags — compilation uses the serialized field name, not the Go name.
- If the field genuinely should exist, verify it is exported and not tagged json:"-" or omitempty-skipped in the compiled shape.
Example fix
// before
{Path: "/userName", Value: "x"} // struct field tagged `json:"user_name"`
// after
{Path: "/user_name", Value: "x"} Defensive patterns
Strategy: validation
Validate before calling
func pathExists(shapeFields []string, p string) bool {
segs := strings.Split(strings.TrimPrefix(p, "/"), "/")
for _, s := range segs {
s = strings.ReplaceAll(strings.ReplaceAll(s, "~1", "/"), "~0", "~")
found := false
for _, f := range shapeFields { if f == s { found = true; break } }
if !found { return false }
}
return true
} Prevention
- Derive override paths from the struct's json tags, not Go field names
- Keep path constants next to the struct definition so renames fail at compile time
- Grep definitions for override paths and diff against json tags when refactoring
When it happens
Trigger: compileData with Output.Data.Overrides where an override Path references a nonexistent field (e.g. "/Nmae" typo, or a field omitted from the compiled shape due to JSON tags/visibility), or resolveShapePointer called with such a pointer.
Common situations: Typos in override paths; renaming a struct field after writing overrides; referencing nested fields that are pointers-to-struct not expanded; fields skipped by compilation (unexported, json:"-").
Related errors
- segment %q has invalid RFC 6901 escaping
- segment %q traverses non-object shape
- must be an RFC 6901 JSON Pointer
- shape has no applicable variant
- value is not valid JSON: %w
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/cc0d389be87e46f3.
Report an issue: GitHub.