alibaba/spring-ai-alibaba · error · BizException
WORKFLOW_EXECUTE_ERROR
WORKFLOW_EXECUTE_ERROR
Error message
Failed to process local image: ${e.getMessage()} What it means
Wraps any exception raised while converting a local File value into a Spring AI Media object in LLMExecuteProcessor.constructMedia. After a non-blank URL is resolved, building Media (URL parsing, media-type lookup via fileManager) can fail; the original exception is logged and rethrown as WORKFLOW_EXECUTE_ERROR.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/workflow/processor/impl/LLMExecuteProcessor.java:346
File file = (File) value;
String url = file.getUrl();
String mimeType = file.getMimeType();
if (StringUtils.isNotBlank(url)) {
String source = file.getSource() == null ? File.SourceEnum.localFile.name() : file.getSource();
try {
if (File.SourceEnum.localFile.name().equals(source)) {
String storagePath = studioProperties.getStoragePath();
return new Media(MimeType.valueOf(mimeType),
new FileUrlResource(storagePath + java.io.File.separator + url));
}
else {
MediaType mediaType = fileManager.getMediaTypeFromUrl(url);
return Media.builder().mimeType(MimeType.valueOf(mediaType.toString())).data(new URL(url)).build();
}
}
catch (Exception e) {
log.error("Error processing local image: {}", url, e);
throw new BizException(
ErrorCode.WORKFLOW_EXECUTE_ERROR.toError("Failed to process local image: " + e.getMessage()));
}
}
return null;
}
/**
* Checks the node parameters for validity
* @param graph The workflow graph
* @param node The node to check
* @return Result of the parameter check
*/
@Override
public CheckNodeParamResult checkNodeParam(DirectedAcyclicGraph<String, Edge> graph, Node node) {
CheckNodeParamResult result = super.checkNodeParam(graph, node);
NodeParam nodeParam = JsonUtils.fromMap(node.getConfig().getNodeParam(), NodeParam.class);
ModelConfig modelConfig = nodeParam.getModelConfig();
if (modelConfig == null || StringUtils.isBlank(modelConfig.getModelId())) {View on GitHub (pinned to f82da0b50f)
Solutions
- Inspect the logged 'Error processing local image' entry to see the underlying cause and the offending url.
- Fix the file record's url so it is a well-formed absolute URL (proper scheme, no unencoded spaces).
- Verify fileManager can resolve the media type for that url's extension/content type; store an explicit mimeType on the File.
- Re-upload the file through the platform's file manager so a valid url and mimeType are generated.
Example fix
// before
file.setUrl("http://example.com/my image.png"); // unencoded space
// after
file.setUrl("http://example.com/my%20image.png");
file.setMimeType("image/png"); Defensive patterns
Strategy: validation
Validate before calling
try { new java.net.URL(file.getUrl()); } catch (MalformedURLException e) { throw new IllegalArgumentException("invalid file url: " + file.getUrl()); }
if (file.getMimeType() == null) { /* resolve mimeType up front */ } Try / catch
try {
processor.invoke(node, params);
} catch (BizException e) {
if ("WORKFLOW_EXECUTE_ERROR".equals(e.getCode())) { log.error("media build failed", e); }
} Prevention
- Validate URL format (scheme, no unencoded spaces) when files are uploaded or registered.
- Always store an explicit mimeType on File records so getMediaTypeFromUrl never has to guess.
- Re-upload files after platform/version migrations rather than trusting legacy url fields.
When it happens
Trigger: The File value has a non-blank url that is malformed (new URL(url) throws MalformedURLException), or fileManager.getMediaTypeFromUrl(url) cannot determine/throws on the media type.
Common situations: Storing a URL with spaces or invalid characters in a file variable; pointing at a scheme the media-type resolver does not recognize; file records from older workflow versions with incomplete url fields; corrupted file entries after a DB migration.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/5ba3a235df22853e.
Report an issue: GitHub.