ITADN

ERROR Failed to save level.dat: Info not found! on first startup — level.dat is never written while running

#2423Closedsoichiro0520 创建于 2026-07-19
bug
S
soichiro0520commented
### I've searched existing issues and couldn't find a duplicate. - [x] I confirm this is not a duplicate. ### Operating System Windows 11 ### Server Software Version/Commit master @ e0117ab5 (built 2026-07-20) ### What happened? I set up a test server and found this ERROR on the very first start (in an empty directory): ``` WARN pumpkin::server: Failed to get level_info, using default instead: Info not found! ERROR pumpkin::server: Failed to save level.dat: Info not found! ``` While the server is running, world/level.dat is never created (other folders like region/ are). It only appears after a graceful stop — I confirmed this on my machine. If the process is killed, no level.dat exists at all. Cause: Server::new calls AnvilLevelInfo.write_world_info (pumpkin/src/server/mod.rs:193) before the world/ directory exists. write_world_info (pumpkin-world/src/world_info/anvil.rs:156) calls File::create, which fails with ErrorKind::NotFound when the parent directory doesn't exist. The world folder is only created later during world loading. Fix plan: call fs::create_dir_all before File::create in write_world_info. Note: I see open PR #2384 touches the same unwrap_or_else block — if it conflicts, I'll rebase. If it's OK, I'd like to work on the fix myself. ### To Reproduce 1. Build latest master 2. Run the server in an empty directory 3. Observe the ERROR at startup, and check that world/level.dat is missing while running 4. Type stop, then check again — level.dat now exists ### Expected behavior No ERROR on first start. level.dat should be written immediately at startup (the world directory should be created before writing).
关闭于 12 天前 2 条评论