larksuite/cli · error

Output.Data.Overrides[%d].Path %q must be an RFC 6901 JSON P

Error message

Output.Data.Overrides[%d].Path %q must be an RFC 6901 JSON Pointer

What it means

Each Output.Data.Overrides entry must use an RFC 6901 JSON Pointer, which must be non-empty and start with '/'. compileData checks this before applying the override and reports the index and offending path value.

Source

Thrown at shortcuts/common/typed_compile_data.go:52

		}
		return shape, nil
	}
	if dataType.Kind() == reflect.Interface && dataType.NumMethod() == 0 {
		if len(definition.Overrides) > 0 {
			return nil, fmt.Errorf("Output.Data.Overrides require struct Data")
		}
		return anyJSONShape{}, nil
	}
	if dataType.Kind() != reflect.Struct {
		return nil, fmt.Errorf("Data must be a non-pointer struct or any unless Output.Data.Shape is explicit, got %s", dataType)
	}
	shape, err := compileStructShape(dataType, false, "Data", map[reflect.Type]struct{}{})
	if err != nil {
		return nil, err
	}
	for i, override := range definition.Overrides {
		if override.Path == "" || !strings.HasPrefix(override.Path, "/") {
			return nil, fmt.Errorf("Output.Data.Overrides[%d].Path %q must be an RFC 6901 JSON Pointer", i, override.Path)
		}
		if err := applyDataOverride(&shape, override); err != nil {
			return nil, fmt.Errorf("Output.Data.Overrides[%d] path %q: %w", i, override.Path, err)
		}
	}
	if err := validateShape(shape, "Output.Data"); err != nil {
		return nil, err
	}
	return shape, nil
}

// shapeForType derives the ValueShape of one Go type. active carries the struct
// types on the current recursion path so a self-referential type is rejected
// with a compile error; see compileStructShape.
func shapeForType(t reflect.Type, schema schemaTag, input bool, active map[reflect.Type]struct{}) (typedValueShape, error) {
	baseType := t
	for baseType.Kind() == reflect.Pointer {
		baseType = baseType.Elem()

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Prefix the Path with '/': "/name" instead of "name".
  2. Convert dot-notation paths to slash-notation: "a.b" -> "/a/b".
  3. Ensure the Path field is actually set (guard against zero-value Override structs).

Example fix

// before
{Path: "name", Value: "x"}
// after
{Path: "/name", Value: "x"}
Defensive patterns

Strategy: validation

Validate before calling

func mustPointerPath(p string) string {
  if p == "" || p[0] != '/' { panic("path must be RFC 6901 pointer: " + p) }
  return p
}

Prevention

When it happens

Trigger: compileData with an Overrides entry whose Path is "" (empty) or lacks the leading '/' (e.g. "name" or "a/b").

Common situations: Passing a bare field name instead of a pointer; forgetting the leading slash; empty Path from a zero-value override struct; building paths with dot notation ("a.b") instead of pointer notation ("/a/b").

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/4d7afa2662f4cb64. Report an issue: GitHub.