{"record":{"id":"a9d86464c3413310","repo":"anomalyco/sst","slug":"invalid-resolver-operation","errorCode":null,"errorMessage":"Invalid resolver ${operation}","messagePattern":"Invalid resolver (.+?)","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/app-sync.ts","lineNumber":821,"sourceCode":"   *   code: `\n   *     export function request(ctx) {\n   *       return {};\n   *     }\n   *     export function response(ctx) {\n   *       return ctx.result;\n   *     }\n   *   `,\n   * });\n   * ```\n   */\n  public addResolver(operation: string, args: AppSyncResolverArgs) {\n    const self = this;\n    const selfName = this.constructorName;\n\n    // Parse field and type\n    const parts = operation.trim().split(/\\s+/);\n    if (parts.length !== 2)\n      throw new VisibleError(`Invalid resolver ${operation}`);\n    const [type, field] = parts;\n\n    const nameSuffix = `${logicalName(type)}` + `${logicalName(field)}`;\n    return new AppSyncResolver(\n      `${selfName}Resolver${nameSuffix}`,\n      {\n        apiId: self.api.id,\n        type,\n        field,\n        ...args,\n      },\n      { provider: this.constructorOpts.provider },\n    );\n  }\n\n  /** @internal */\n  public getSSTLink() {\n    return {","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/app-sync.ts#L803-L839","documentation":"`addResolver(operation)` expects a string of exactly two whitespace-separated tokens: the type name and the field, e.g. `\"Query getUser\"`. The parser splits the trimmed operation on whitespace; anything other than 2 parts (0, 1, or 3+ tokens) is rejected with a VisibleError showing the raw input.","triggerScenarios":"Calling `api.addResolver(\"Query.getUser\")` (dot notation), `api.addResolver(\"Query\")` (field omitted), or `api.addResolver(\"Mutation create  Item extra\")` — any string that does not split into exactly two tokens.","commonSituations":"Using GraphQL-style `Type.field` dot syntax instead of the space-separated form SST expects, or forgetting the field entirely when wiring a resolver.","solutions":["Use space-separated syntax: `api.addResolver(\"Query.getUser\", { ... })`","Ensure exactly one space between type and field and no trailing tokens","Verify the type name matches a type defined in your GraphQL schema (e.g. Query, Mutation, Subscription)"],"exampleFix":"// before\napi.addResolver(\"Query.getUser\", { ... });\n// after\napi.addResolver(\"Query getUser\", { ... });","handlingStrategy":"validation","validationCode":"function parseResolverOperation(op) {\n  const parts = op.trim().split(/\\s+/);\n  if (parts.length !== 2) throw new Error(`addResolver expects \"Type field\" (space-separated), got: \"${op}\"`);\n  return { type: parts[0], field: parts[1] };\n}","typeGuard":"function isResolverOperation(op) {\n  return typeof op === \"string\" && op.trim().split(/\\s+/).length === 2;\n}","tryCatchPattern":"null","preventionTips":["Always use the space-separated \"Type field\" format, never \"Type.field\"","Wrap addResolver calls in a helper that validates the two-token format","Keep resolver registrations in one module so format mistakes are caught in one place"],"tags":["appsync","resolver","argument-format","config-validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}