Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#1939 formatUserModelError reports 'Missing required methods field' for any method sub-field validation failure

Opened by stack72 · 9/1/2026· Shipped 9/1/2026

Summary

formatUserModelError in src/domain/extensions/model_kind_adapter.ts has a catch-all at line 232 that matches ANY Zod issue where path[0] === "methods" and reports it as "Missing required 'methods' field". This produces a misleading error when the methods field exists but has an internal validation failure — e.g. an invalid kind enum value, execute not being a function, or a missing description.

Reproduce

Any model where methods exist but a sub-field fails validation. For example, a method with run instead of execute:

export const model = {
  type: "@example/test",
  version: "2026.01.01.1",
  methods: {
    create: {
      description: "Create",
      arguments: z.object({}),
      async run(args) { return {}; },  // should be `execute`, not `run`
    },
  },
};

This reports: "Missing required 'methods' field. Add at least one method to your model."

Expected

The error should identify the specific sub-field that failed and on which method, e.g.:

  • "Invalid 'execute' on method 'create'. 'execute' must be an async function."
  • "Invalid 'kind' value on method 'connect'. Allowed values: create, read, update, delete, list, action."

Impact

This was the root cause of a confusing customer report (all @xero/salesforce/d360/* extensions failing with "Missing required 'methods' field" during extension pull --server). Their auto-generated models used run instead of execute on every method. The misleading error sent them on a wild goose chase because methods clearly existed in source and compiled bundles.

Fix

Split the catch-all into: (1) path.length === 1 → truly missing methods, (2) specific messages for kind, execute, description sub-fields, (3) a fallback that includes the actual path and Zod message.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/1/2026, 11:46:55 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack729/1/2026, 11:16:20 PM

Sign in to post a ripple.