Skip to content

Validator error should specify source (line no. or calling function) #167

@okomarov

Description

@okomarov

The error message does not tell you where the issue is (line or calling function)

11/18/2025, 12:41:17 PM [CONVEX M(worker:runMutationWrapper)] [ERROR] [Error: ArgumentValidationError: Object contains extra field mainDetails that is not in the validator.

Object: {companyId: "j57cbywe1te7fvzf26g0x3ftsd7vagd2", mainDetails: {...redacted}}
Validator: v.object({companyId: v.id("company")})
]

11/18/2025, 12:41:17 PM [CONVEX M(worker:runMutationWrapper)] [ERROR] 'Error: ArgumentValidationError: Object contains extra field mainDetails that is not in the validator.\n\nObject: {companyId: "j57cbywe1te7fvzf26g0x3ftsd7vagd2", mainDetails: {...redacted}}\nValidator: v.object({companyId: v.id("company")})\n\n at completeMessage [as completeMessage] (../../node_modules/@convex-dev/workflow/src/client/step.ts:146:8)\n at run [as run] (../../node_modules/@convex-dev/workflow/src/client/step.ts:84:8)\n at async executorWorker (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)\n at async handler (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)'

11/18/2025, 12:41:18 PM [CONVEX M(worker:runMutationWrapper)] [ERROR] 'Error: Error: ArgumentValidationError: Object contains extra field mainDetails that is not in the validator.\n\nObject: {companyId: "j57cbywe1te7fvzf26g0x3ftsd7vagd2", mainDetails: {...redacted}}
Validator: v.object({companyId: v.id("company")})\n\n at completeMessage [as completeMessage] (../../node_modules/@convex-dev/workflow/src/client/step.ts:146:8)\n at run [as run] (../../node_modules/@convex-dev/workflow/src/client/step.ts:84:8)\n at async executorWorker (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)\n at async handler (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)\n at completeMessage [as completeMessage] (../../node_modules/@convex-dev/workflow/src/client/step.ts:146:8)\n at run [as run] (../../node_modules/@convex-dev/workflow/src/client/step.ts:84:8)\n at async executorWorker (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)\n at async handler (../../node_modules/@convex-dev/workflow/src/client/workflowMutation.ts:170:27)'

This is the offending code:

export const marketSegmentsWorkflow = workflowManager.define({
  args: {
    companyId: v.id('company'),
    mainDetails: mainDetailsConvexObject,
  },
  returns: v.array(v.string()),
  handler: async (step, args): Promise<string[]> => {
    const existingSegments = await step.runQuery(
      market_analysis.db.getMarketSegmentsInternal,
      args,                                         <---------------- HERE
    );

  ...
});

This is not easy to catch, as there are no linting or build errors and the error message does not point to anywhere in the source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions