n8n-io/n8n · error · NodeOperationError

The resource "${resource}" is not supported!

Error message

The resource "${resource}" is not supported!

What it means

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.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vendors/Moonshot/actions/router.ts:28

	const items = this.getInputData();
	const resource = this.getNodeParameter('resource', 0);
	const operation = this.getNodeParameter('operation', 0);

	const moonshotTypeData = {
		resource,
		operation,
	} as MoonshotType;

	let execute;
	switch (moonshotTypeData.resource) {
		case 'image':
			execute = image[moonshotTypeData.operation].execute;
			break;
		case 'text':
			execute = text[moonshotTypeData.operation].execute;
			break;
		default:
			throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`);
	}

	for (let i = 0; i < items.length; i++) {
		try {
			const responseData = await execute.call(this, i);
			returnData.push(...responseData);
		} catch (error) {
			if (this.continueOnFail()) {
				returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
				continue;
			}

			throw new NodeOperationError(this.getNode(), error, {
				itemIndex: i,
				description: error.description,
			});
		}
	}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the node in the n8n UI and re-select the resource from the dropdown.
  2. Inspect the workflow JSON's resource field and set it to 'image' or 'text'.
  3. Update the Moonshot node to the latest version so router and enum agree.
  4. After importing a workflow, remap the resource field to the current enum.
Defensive patterns

Strategy: validation

Validate before calling

const MOONSHOT_RESOURCES = ['image', 'text'] as const;
type MoonshotResource = typeof MOONSHOT_RESOURCES[number];
function isValidMoonshotResource(r: unknown): r is MoonshotResource {
  return typeof r === 'string' && (MOONSHOT_RESOURCES as readonly string[]).includes(r);
}

const resource = this.getNodeParameter('resource', 0) as unknown;
if (!isValidMoonshotResource(resource)) {
  throw new NodeOperationError(
    this.getNode(),
    `Resource '${String(resource)}' is invalid. Supported: ${MOONSHOT_RESOURCES.join(', ')}.`,
  );
}

Type guard

function isMoonshotResource(r: unknown): r is 'image' | 'text' {
  return r === 'image' || r === 'text';
}

Try / catch

// This is a programming/data error, not a transient one — do not retry.
// Validate up front (see validationCode) so the user gets a clear message.

Prevention

When it happens

Trigger: 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.

Common situations: Direct JSON editing; imported workflow from a different n8n version with renamed resources; localization leaked into the parameter; community fork renamed resources.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/be088eff84c51372. Report an issue: GitHub.