n8n-io/n8n · error · NodeOperationError

The operation "${operation}" is not supported for resource "

Error message

The operation "${operation}" is not supported for resource "${resource}"

What it means

Thrown by the AlibabaCloud (Bailian/Tongyi) router when the selected operation is not valid for the selected resource. The router dispatches resource (text/image/video) to a nested operation switch; each resource only accepts a fixed set of operations (text→message; image→analyze|generate; video→textToVideo|imageToVideo). Any other operation hits the nested default and throws.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vendors/AlibabaCloud/actions/router.ts:23

import * as image from './image';
import * as video from './video';

export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
	const items = this.getInputData();
	const returnData: INodeExecutionData[] = [];

	const resource = this.getNodeParameter('resource', 0) as string;
	const operation = this.getNodeParameter('operation', 0) as string;

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

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Re-open the node and pick a valid operation for the chosen resource (text: message; image: analyze|generate; video: textToVideo|imageToVideo).
  2. If the workflow is old, recreate the AlibabaCloud node from scratch to get the current operation list.
  3. If resource/operation come from expressions, ensure they resolve to one of the supported string values.
  4. Update n8n/nodes-langchain so the node definition matches the parameters saved in the workflow.

Example fix

// before: resource = 'text', operation = 'generate'  (invalid)
// after:  resource = 'image', operation = 'generate'   (valid pair)
Defensive patterns

Strategy: validation

Validate before calling

const VALID: Record<string, Set<string>> = { text: new Set(['message']), image: new Set(['analyze','generate']), video: new Set(['textToVideo','imageToVideo']) }; if (!VALID[resource]?.has(operation)) { throw new Error(`Invalid pair: resource='${resource}' operation='${operation}'`); }

Type guard

function isValidPair(resource: string, operation: string): boolean { const m: Record<string, readonly string[]> = { text: ['message'], image: ['analyze','generate'], video: ['textToVideo','imageToVideo'] }; return !!m[resource] && m[resource].includes(operation); }

Try / catch

try { await router.call(this) } catch (e) { if (/is not supported for resource/.test(e.message)) { /* reset operation to a valid one for the resource */ } else throw e; }

Prevention

When it happens

Trigger: resource + operation pair is invalid, e.g. resource='text' with operation='generate', or resource='video' with operation='message'. Can also occur if parameters are loaded from a saved workflow where the operation was renamed/removed in a newer node version, or when operation/resource are set via expression to values the switch does not handle.

Common situations: Saved workflow using an operation removed/renamed in a node update; expression-driven resource/operation resolving to an unsupported value; manual JSON edit of the node parameters producing an invalid pair; partial copy-paste of node config.

Related errors


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