n8n-io/n8n · error · NodeOperationError

Parameter ${key} must be a string

Error message

Parameter ${key} must be a string

What it means

getParameter() in VectorStoreAzureAISearch reads a node parameter with extractValue:true and requires the result to be a string. If the value is an object, array, number, or an expression resolving to a non-string, it throws NodeOperationError. getIndexName is getParameter bound to INDEX_NAME, so the index name is the most common offender.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts:150

): context is IExecuteFunctions | ISupplyDataFunctions {
	// IExecuteFunctions and ISupplyDataFunctions have addInputData method
	// ILoadOptionsFunctions does not
	return 'addInputData' in context;
}

function getParameter(key: string, context: IFunctionsContext, itemIndex: number): string {
	let value: unknown;

	if (isExecutionContext(context)) {
		// Execution context: includes itemIndex parameter
		value = context.getNodeParameter(key, itemIndex, '', { extractValue: true });
	} else {
		// Load options context: no itemIndex parameter
		value = context.getNodeParameter(key, '', { extractValue: true });
	}

	if (typeof value !== 'string') {
		throw new NodeOperationError(context.getNode(), `Parameter ${key} must be a string`);
	}
	return value;
}

export const getIndexName = getParameter.bind(null, INDEX_NAME);

function getOptionValue<T>(
	name: string,
	context: IExecuteFunctions | ISupplyDataFunctions,
	itemIndex: number,
	defaultValue?: T,
): T | undefined {
	const options: IDataObject = context.getNodeParameter('options', itemIndex, {});
	return options[name] !== undefined ? (options[name] as T) : defaultValue;
}

interface ValidatedCredentials {
	endpoint: string;

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Ensure the parameter (typically the index name) evaluates to a plain string — fix the expression so it returns a string.
  2. If the value can legitimately be non-string, wrap it: pass a string literal or use a Set node to coerce it before the Azure AI Search node.
  3. Open the node and re-enter the index name as a fixed string to verify.

Example fix

// before: index name = {{ $json }} (an object)
// after:  index name = {{ $json.indexName }} (a string field)
Defensive patterns

Strategy: type-guard

Type guard

function isStringParam(v: unknown): v is string {
  return typeof v === 'string';
}
// usage: const v = context.getNodeParameter(key, itemIndex, '', { extractValue: true });
// if (!isStringParam(v)) throw new Error(`${key} must resolve to a string`);

Prevention

When it happens

Trigger: context.getNodeParameter(key, ..., { extractValue: true }) returns a non-string (e.g. an object/array from a fixed collection, or an expression whose result is not a string), failing the typeof value !== 'string' check.

Common situations: Using an expression for the index name that resolves to an object or array; a parameter value that n8n returns as a typed collection rather than a string; node-version mismatch changing a parameter's resolved type.

Related errors


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