{"record":{"id":"be088eff84c51372","repo":"n8n-io/n8n","slug":"the-resource-resource-is-not-supported-be088e","errorCode":null,"errorMessage":"The resource \"${resource}\" is not supported!","messagePattern":"The resource \"(.+?)\" is not supported!","errorType":"validation","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/Moonshot/actions/router.ts","lineNumber":28,"sourceCode":"\tconst items = this.getInputData();\n\tconst resource = this.getNodeParameter('resource', 0);\n\tconst operation = this.getNodeParameter('operation', 0);\n\n\tconst moonshotTypeData = {\n\t\tresource,\n\t\toperation,\n\t} as MoonshotType;\n\n\tlet execute;\n\tswitch (moonshotTypeData.resource) {\n\t\tcase 'image':\n\t\t\texecute = image[moonshotTypeData.operation].execute;\n\t\t\tbreak;\n\t\tcase 'text':\n\t\t\texecute = text[moonshotTypeData.operation].execute;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new NodeOperationError(this.getNode(), `The resource \"${resource}\" is not supported!`);\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst responseData = await execute.call(this, i);\n\t\t\treturnData.push(...responseData);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { error: error.message }, pairedItem: { item: i } });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\titemIndex: i,\n\t\t\t\tdescription: error.description,\n\t\t\t});\n\t\t}\n\t}","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/Moonshot/actions/router.ts#L10-L46","documentation":"Default branch of the Moonshot router switch on the resource parameter. Supported values are image and text; any other value falls through to this throw. As with the MiniMax router, the UI enum normally prevents this, but hand-edited workflow JSON, stale node definitions, or renamed resources can reach it.","triggerScenarios":"Workflow JSON has resource set to a value not in {image, text}; node definition and router shipped out of sync; corrupted/migrated workflow with a legacy or localized resource string; programmatic workflow injection with an invalid resource.","commonSituations":"Direct JSON editing; imported workflow from a different n8n version with renamed resources; localization leaked into the parameter; community fork renamed resources.","solutions":["Open the node in the n8n UI and re-select the resource from the dropdown.","Inspect the workflow JSON's resource field and set it to 'image' or 'text'.","Update the Moonshot node to the latest version so router and enum agree.","After importing a workflow, remap the resource field to the current enum."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const MOONSHOT_RESOURCES = ['image', 'text'] as const;\ntype MoonshotResource = typeof MOONSHOT_RESOURCES[number];\nfunction isValidMoonshotResource(r: unknown): r is MoonshotResource {\n  return typeof r === 'string' && (MOONSHOT_RESOURCES as readonly string[]).includes(r);\n}\n\nconst resource = this.getNodeParameter('resource', 0) as unknown;\nif (!isValidMoonshotResource(resource)) {\n  throw new NodeOperationError(\n    this.getNode(),\n    `Resource '${String(resource)}' is invalid. Supported: ${MOONSHOT_RESOURCES.join(', ')}.`,\n  );\n}","typeGuard":"function isMoonshotResource(r: unknown): r is 'image' | 'text' {\n  return r === 'image' || r === 'text';\n}","tryCatchPattern":"// This is a programming/data error, not a transient one — do not retry.\n// Validate up front (see validationCode) so the user gets a clear message.","preventionTips":["Select resource from the node UI dropdown rather than editing JSON by hand.","After importing a workflow, re-select each Moonshot node's resource to reset it to a valid enum value.","Keep the Moonshot node updated so the UI enum and router switch stay in sync.","If forking the node, add new resources to both the parameter enum and the router switch in the same commit."],"tags":["moonshot","router","resource","enum","workflow-json"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}