{"record":{"id":"08c31d3c65f1f26f","repo":"pentaho/pentaho-kettle","slug":"purrepository-filecreateexception","errorCode":"PurRepository.fileCreateException","errorMessage":"PurRepository.fileCreateException (localized, takes file name; error creating file)","messagePattern":"PurRepository\\.fileCreateException \\(localized, takes file name; error creating file\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":3509,"sourceCode":"    } else {\n\n      int dataSize = calculateDataSize( element );\n\n      readWriteLock.writeLock().lock();\n      try {\n        file =\n          new RepositoryFile.Builder( checkAndSanitize( element.getName()\n            + element.getRepositoryElementType().getExtension() ) ).versioned( true ).title(\n            RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate(\n            versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE,\n            Const.NVL( element.getDescription(), \"\" ) ).fileSize( dataSize ).build();\n\n        file =\n          pur.createFile( element.getRepositoryDirectory().getObjectId().getId(), file,\n            new NodeRepositoryFileData( objectTransformer.elementToDataNode( element ), dataSize ), versionComment );\n      } catch ( SOAPFaultException e ) {\n        if ( e.getMessage().contains( UnifiedRepositoryCreateFileException.PREFIX ) ) {\n          throw new KettleException(\n            BaseMessages.getString( PKG, \"PurRepository.fileCreateException\", file.getName() ) );\n        }\n      } finally {\n        readWriteLock.writeLock().unlock();\n      }\n    }\n    // side effects\n    ObjectId objectId = new StringObjectId( file.getId().toString() );\n    element.setObjectId( objectId );\n    if ( loadRevision ) {\n      element.setObjectRevision( getObjectRevision( objectId, null ) );\n    }\n    if ( element instanceof ChangedFlagInterface ) {\n      ( (ChangedFlagInterface) element ).clearChanged();\n    }\n\n    if ( element.getRepositoryElementType() == RepositoryObjectType.TRANSFORMATION ) {\n      TransMeta transMeta = loadTransformation( objectId, null );","sourceCodeStart":3491,"sourceCodeEnd":3527,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L3491-L3527","documentation":"When creating a new file, a SOAPFaultException whose message contains UnifiedRepositoryCreateFileException.PREFIX means the repository server refused to create the file. PurRepository rewraps it into a localized 'error creating file' KettleException with the file name — usually because a file with that name already exists in the target folder.","triggerScenarios":"pur.createFile(...) throws SOAPFaultException containing UnifiedRepositoryCreateFileException.PREFIX, typically for a name collision in the destination folder.","commonSituations":"Saving a transformation/job with a name that already exists in the chosen folder; creating a file where the user lacks create permission; transient repository server errors during creation.","solutions":["Rename the file or choose a different folder and retry","Check whether the target folder already contains a file with the same name and delete/archive it first","Verify the user has create permission in the destination directory","Inspect the repository server logs for the wrapped UnifiedRepositoryCreateFileException cause"],"exampleFix":"// before\nrepository.save(transMeta, \"v\", null, true); // name already exists -> error\n// after\nif (!repository.exists(transMeta.getRepositoryDirectory().getPath() + \"/\" + transMeta.getName() + \".ktr\", null)) {\n  repository.save(transMeta, \"v\", null, true);\n}","handlingStrategy":"validation","validationCode":"String path = element.getRepositoryDirectory().getPath() + \"/\" + element.getName()\n    + element.getRepositoryElementType().getExtension();\nif (repository.exists(path, null)) {\n  throw new KettleException(\"File already exists: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  repository.save(element, comment, null, true);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"error creating\")) {\n    // pick a unique name or different folder, then retry\n  } else throw e;\n}","preventionTips":["Check repository.exists(path) before creating a new file","Use unique naming conventions per folder","Ensure the user has create permissions in the target directory"],"tags":["kettle","pentaho","repository","soap","file-create","name-collision"],"backgroundTag":"file-already-exists","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}