{"record":{"id":"c66ae22a4dbe01c1","repo":"fluent/fluentd","slug":"plugin-storage-path-path-is-not-readable-wri","errorCode":null,"errorMessage":"Plugin storage path '#{@path}' is not readable/writable","messagePattern":"Plugin storage path '#(.+?)' is not readable/writable","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/storage_local.rb","lineNumber":86,"sourceCode":"        else\n          if @persistent\n            raise Fluent::ConfigError, \"Plugin @id or path for <storage> required when 'persistent' is true\"\n          else\n            if @autosave\n              log.warn \"both of Plugin @id and path for <storage> are not specified. Using on-memory store.\"\n            else\n              log.info \"both of Plugin @id and path for <storage> are not specified. Using on-memory store.\"\n            end\n            @on_memory = true\n            @multi_workers_available = true\n          end\n        end\n\n        if !@on_memory\n          dir = File.dirname(@path)\n          FileUtils.mkdir_p(dir, mode: @dir_mode) unless Dir.exist?(dir)\n          if File.exist?(@path)\n            raise Fluent::ConfigError, \"Plugin storage path '#{@path}' is not readable/writable\" unless File.readable?(@path) && File.writable?(@path)\n            begin\n              data = File.open(@path, 'r:utf-8:utf-8') { |io| io.read }\n              if data.empty?\n                log.warn \"detect empty plugin storage file during startup. Ignored: #{@path}\"\n                return\n              end\n              data = JSON.parse(data, Fluent::DEFAULT_JSON_PARSE_OPTIONS)\n              raise Fluent::ConfigError, \"Invalid contents (not object) in plugin storage file: '#{@path}'\" unless data.is_a?(Hash)\n            rescue => e\n              log.error \"failed to read data from plugin storage file\", path: @path, error: e\n              raise Fluent::ConfigError, \"Unexpected error: failed to read data from plugin storage file: '#{@path}'\"\n            end\n          else\n            raise Fluent::ConfigError, \"Directory is not writable for plugin storage file '#{@path}'\" unless File.stat(dir).writable?\n          end\n        end\n      end\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/storage_local.rb#L68-L104","documentation":"During LocalStorage#configure (storage_local.rb:86), if the resolved storage file already exists but the fluentd process cannot both read and write it (File.readable? or File.writable? false), configuration fails with this Fluent::ConfigError. LocalStorage rewrites the whole JSON file on every save, so read-only or non-writable state files cannot be honored; the error usually indicates an ownership mismatch between the file and the user running fluentd.","triggerScenarios":"An existing storage.json (or path-specified storage file) owned by root while fluentd runs as the fluent user; a file with mode 0644 owned by another user so File.writable? is false; state files restored from backup with restrictive permissions (e.g. rsync -a preserving root ownership) and then reused at startup.","commonSituations":"Switching fluentd from root to a non-root service user after state files were created; Docker images where state paths were volume-mounted with wrong ownership; SELinux or read-only mounts making an existing file unwritable; files created by a different worker id layout during a multi-worker migration.","solutions":["Fix ownership of the storage file to the fluentd runtime user: chown fluent:fluent /path/to/storage.json (and its directory)","Ensure the mode allows owner read/write: chmod 0600 or 0644 owned by the running user","If the permissions are intentional (read-only snapshot), move or delete the stale file so LocalStorage recreates it — but note saved state will be lost","When running under systemd/Docker, verify User=, ReadOnlyPaths=, or volume mount options are not making the file unwritable"],"exampleFix":"# before\n$ ls -l /var/log/fluent/storage.json\n-rw------- 1 root root 1024 ... storage.json\n# fluentd (as user 'fluent') fails:\n# Plugin storage path '...' is not readable/writable\n\n# after\n$ sudo chown fluent:fluent /var/log/fluent/storage.json\n$ sudo chmod 0600 /var/log/fluent/storage.json","handlingStrategy":"validation","validationCode":"path = '/var/log/fluent/storage.json'\nif File.exist?(path) && !(File.readable?(path) && File.writable?(path))\n  raise \\\"storage file #{path} not readable/writable by #{Process.uid}\\\"\nend","typeGuard":null,"tryCatchPattern":"begin\n  plugin.configure(conf)\nrescue Fluent::ConfigError => e\n  if e.message.include?('not readable/writable')\n    warn 'Fix ownership of the storage file and restart'; exit 1\n  end\n  raise\nend","preventionTips":["Create state directories and files owned by the fluentd runtime user at provisioning time (chown fluent:fluent)","After switching the service user or restoring backups, audit ownership of all storage paths before restart","Use systemd's or the container runtime's declared User consistently for creation and runtime","Include a permissions preflight (test -r/-w on state paths) in deployment scripts"],"tags":["fluentd","storage","permissions","filesystem","config-error","startup"],"backgroundTag":"file-permission-denied","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}