alibaba/spring-ai-alibaba · error · RuntimeException

Unsupported language: {language}

Error message

Unsupported language: {language}

What it means

CodeExecutorNodeAction.executeWorkflowCodeTemplate looks up a TemplateTransformer for the requested CodeLanguage in the CODE_TEMPLATE_TRANSFORMERS registry. If no transformer is registered for that language (meaning the executor can't prepare runner/preload scripts for it), it throws RuntimeException('Unsupported language: ' + language). The code-execution feature only supports languages present in the registry.

Source

Thrown at spring-boot-starters/spring-ai-alibaba-starter-builtin-nodes/src/main/java/com/alibaba/cloud/ai/graph/node/code/CodeExecutorNodeAction.java:84

			CodeLanguage.PYTHON3.getValue(), CodeLanguage.PYTHON, CodeLanguage.PYTHON.getValue(), CodeLanguage.JAVA,
			CodeLanguage.JAVA.getValue());

	public CodeExecutorNodeAction(CodeExecutor codeExecutor, String codeLanguage, String code, CodeStyle style,
			CodeExecutionConfig config, List<CodeParam> params, String outputKey) {
		this.codeExecutor = codeExecutor;
		this.codeLanguage = codeLanguage;
		this.style = style;
		this.code = code;
		this.codeExecutionConfig = config;
		this.params = params;
		this.outputKey = outputKey;
	}

	private Map<String, Object> executeWorkflowCodeTemplate(CodeLanguage language, String code,
			Map<String, Object> inputs) throws Exception {
		TemplateTransformer templateTransformer = CODE_TEMPLATE_TRANSFORMERS.get(language);
		if (templateTransformer == null) {
			throw new RuntimeException("Unsupported language: " + language);
		}

		RunnerAndPreload runnerAndPreload = templateTransformer.transformCaller(code, inputs, style);
		String response = executeCode(language, runnerAndPreload.preloadScript(), runnerAndPreload.runnerScript());

		return templateTransformer.transformResponse(response);
	}

	private String executeCode(CodeLanguage language, String preloadScript, String code) throws Exception {
		List<CodeBlock> codeBlockList = new ArrayList<>(10);
		codeBlockList.add(new CodeBlock(CODE_LANGUAGE_TO_RUNNING_LANGUAGE.get(language), code));

		CodeExecutionResult codeExecutionResult = codeExecutor.executeCodeBlocks(codeBlockList,
				this.codeExecutionConfig);
		if (codeExecutionResult.exitCode() != 0) {
			throw new RuntimeException("code execution failed, exit code: " + codeExecutionResult.exitCode()
					+ ", logs: " + codeExecutionResult.logs());
		}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Switch the node to a supported CodeLanguage (e.g. one known to have a registered transformer)
  2. Check the supported-language list/registry in your library version and upgrade if a newer version adds your language
  3. Confirm the language configured in your workflow matches the enum used by the executor

Example fix

// before
new CodeExecutorNodeAction(config, CodeLanguage.RUST, code, ...); // not registered
// after
new CodeExecutorNodeAction(config, CodeLanguage.PYTHON, code, ...);
Defensive patterns

Strategy: validation

Validate before calling

Set<CodeLanguage> supported = Set.of(CodeLanguage.PYTHON /* per registry */);
if (!supported.contains(language)) { throw new IllegalArgumentException("language not supported: " + language); }

Type guard

boolean isSupported(CodeLanguage l) { return l != null && registeredLanguages().contains(l); }

Try / catch

try { result = action.call(state); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unsupported language")) { log.error(e.getMessage()); } }

Prevention

When it happens

Trigger: Building/running CodeExecutorNodeAction with CodeLanguage value for which no template transformer was registered — e.g. a language enum value with no CODE_TEMPLATE_TRANSFORMERS mapping.

Common situations: Using a newly added enum constant not yet wired into the transformer map; misconfiguration of the node's language setting; copying an example with a language the current version doesn't support.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/5aebd3b383714ff6. Report an issue: GitHub.