{"record":{"id":"fbd8e69675021575","repo":"flowable/flowable-engine","slug":"file-must-be-of-type-bpmn20-xml-bpmn-bar-or","errorCode":null,"errorMessage":"File must be of type .bpmn20.xml, .bpmn, .bar or .zip","messagePattern":"File must be of type \\.bpmn20\\.xml, \\.bpmn, \\.bar or \\.zip","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java","lineNumber":209,"sourceCode":"            if (StringUtils.isEmpty(fileName) || !(fileName.endsWith(\".bpmn20.xml\") || fileName.endsWith(\".bpmn\") || fileName.toLowerCase().endsWith(\".bar\") || fileName.toLowerCase().endsWith(\".zip\"))) {\n\n                fileName = file.getName();\n            }\n\n            if (fileName.endsWith(\".bpmn20.xml\") || fileName.endsWith(\".bpmn\")) {\n            \ttry (final InputStream fileInputStream = file.getInputStream()) {\n                    deploymentBuilder.addInputStream(fileName, fileInputStream);\n                }\n            \t\n            } else if (fileName.toLowerCase().endsWith(\".bar\") || fileName.toLowerCase().endsWith(\".zip\")) {\n            \ttry (InputStream fileInputStream = file.getInputStream();\n                        ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {\n            \t\t\n            \t\tdeploymentBuilder.addZipInputStream(zipInputStream);\n            \t}\n\n            } else {\n                throw new FlowableIllegalArgumentException(\"File must be of type .bpmn20.xml, .bpmn, .bar or .zip\");\n            }\n\n            if (!decodedQueryStrings.containsKey(\"deploymentName\") || StringUtils.isEmpty(decodedQueryStrings.get(\"deploymentName\"))) {\n                String fileNameWithoutExtension = fileName.split(\"\\\\.\")[0];\n\n                if (StringUtils.isNotEmpty(fileNameWithoutExtension)) {\n                    fileName = fileNameWithoutExtension;\n                }\n\n                deploymentBuilder.name(fileName);\n                \n            } else {\n                deploymentBuilder.name(decodedQueryStrings.get(\"deploymentName\"));\n            }\n\n            if (decodedQueryStrings.containsKey(\"deploymentKey\") && StringUtils.isNotEmpty(decodedQueryStrings.get(\"deploymentKey\"))) {\n                deploymentBuilder.key(decodedQueryStrings.get(\"deploymentKey\"));\n            }","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/DeploymentCollectionResource.java#L191-L227","documentation":"FlowableIllegalArgumentException thrown when the uploaded file's name does not have one of the accepted extensions: .bpmn20.xml, .bpmn, .bar or .zip. uploadDeployment dispatches on the file extension (xml is added directly, zip/bar via ZipInputStream) and rejects anything else.","triggerScenarios":"Uploading a file named e.g. process.xml, diagram.png, model.bpmnxml, or a BPMN file without any extension to POST /repository/deployments; the extension check happens before any parsing.","commonSituations":"Files exported with a .xml extension instead of .bpmn20.xml, Camel-cased or missing extensions, renamed files, or uploading the whole model JSON from the Flowable modeler instead of the exported BPMN XML.","solutions":["Rename the file to use an accepted extension, e.g. process.bpmn20.xml or process.bpmn","Package multiple resources into a .bar or .zip archive and upload that","Export the BPMN XML from the modeler rather than uploading the model source file","Check the file name is URL-decoded correctly (the extension check uses the decoded query/name)"],"exampleFix":"// before\nmv process.xml process.xml  // rejected: unsupported extension\ncurl -F \"file=@process.xml\" ...\n// after\nmv process.xml process.bpmn20.xml\ncurl -F \"file=@process.bpmn20.xml\" ...","handlingStrategy":"validation","validationCode":"const ok = /\\.(bpmn20\\.xml|bpmn|bar|zip)$/i.test(filename);\nif (!ok) throw new Error(`Rename ${filename} to .bpmn20.xml, .bpmn, .bar or .zip before uploading`);","typeGuard":"function isDeployableFile(name) {\n  return /\\.(bpmn20\\.xml|bpmn|bar|zip)$/i.test(name);\n}","tryCatchPattern":"try {\n    deploy(file)\n} catch (BadRequest e) {\n    if (e.message?.includes('File must be of type')) {\n        throw new Error(`Unsupported extension: ${file.name}. Use .bpmn20.xml, .bpmn, .bar or .zip`);\n    }\n}","preventionTips":["Standardize on .bpmn20.xml for single process files","Bundle multiple resources into .bar/.zip archives","Export from the Flowable modeler as BPMN XML instead of uploading model source files"],"tags":["file-extension","validation","deployment","rest"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}