{"record":{"id":"b9a3c8feb1b2deea","repo":"provectus/kafka-ui","slug":"error-writing-to","errorCode":null,"errorMessage":"Error writing to ","messagePattern":"Error writing to ","errorType":"validation","errorClass":"ValidationException","httpStatus":400,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/DynamicConfigOperations.java","lineNumber":191,"sourceCode":"    if (Files.isDirectory(path)) {\n      throw new ValidationException(\"Dynamic file path is a directory, but should be a file path\");\n    }\n    if (!Files.exists(path.getParent())) {\n      Files.createDirectories(path.getParent());\n    }\n    if (Files.exists(path) && !Files.isWritable(path)) {\n      throw new ValidationException(\"File already exists and is not writable\");\n    }\n    try {\n      Files.writeString(\n          path,\n          yaml,\n          StandardOpenOption.CREATE,\n          StandardOpenOption.WRITE,\n          StandardOpenOption.TRUNCATE_EXISTING // to override existing file\n      );\n    } catch (IOException e) {\n      throw new ValidationException(\"Error writing to \" + path, e);\n    }\n  }\n\n  private String serializeToYaml(PropertiesStructure props) {\n    //representer, that skips fields with null values\n    Representer representer = new Representer(new DumperOptions()) {\n      @Override\n      protected NodeTuple representJavaBeanProperty(Object javaBean,\n                                                    Property property,\n                                                    Object propertyValue,\n                                                    Tag customTag) {\n        if (propertyValue == null) {\n          return null; // if value of property is null, ignore it.\n        } else {\n          return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);\n        }\n      }\n    };","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/DynamicConfigOperations.java#L173-L209","documentation":"The final step of writeYamlToFile() wraps Files.writeString in try/catch; any IOException while actually writing the YAML (disk full, I/O error, filesystem failure) is rethrown as ValidationException with message 'Error writing to <path>' and the original IOException as cause.","triggerScenarios":"Persisting dynamic config when the underlying Files.writeString fails: no space left on device, I/O error on the volume, transient NFS failure, or the file becoming unwritable between the earlier check and the write.","commonSituations":"Full disk on the node hosting the config volume; volume detached or remounted read-only after startup; quota exceeded on the storage.","solutions":["Inspect the cause (IOException) in the logs for the concrete reason (NoSpaceLeftOnDevice, etc.)","Free disk space or expand the volume, then retry the config change","Re-mount/repair the volume and confirm the path is writable before retrying"],"exampleFix":"// shell: diagnose\n df -h /etc/kafka-ui   # check free space\n lsattr application-config.yml  # check immutable flag\n// after\n chattr -i application-config.yml  # if immutable flag was set","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  dynamicConfigOperations.persist(props);\n} catch (ValidationException e) {\n  log.error(\"Failed writing dynamic config: {}\", e.getMessage(), e.getCause());\n  Throwable cause = e.getCause();\n  if (cause instanceof IOException io && io.getMessage().contains(\"No space left\")) {\n    // alert on disk usage and retry after freeing space\n  }\n}","preventionTips":["Monitor disk usage on the volume hosting the config file","Keep the config path on a reliable local or durable volume","Retry persistence with backoff after transient I/O errors"],"tags":["filesystem","io","dynamic-config"],"backgroundTag":"file-write-failed","analyzedSha":"83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7","analyzedAt":"2026-09-08T04:35:39.002Z","contentChangedAt":"2026-09-08T04:35:39.002Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}