From 57ffef85435b1428af29a68e2328eba9e7b40922 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 26 Jun 2026 17:36:42 -0700 Subject: [PATCH] fix(admin): skip task state files with no task data on load An empty or truncated tasks/*.pb file unmarshals into a TaskStateFile with a nil Task, and protobufToMaintenanceTask dereferenced it immediately, panicking the whole admin process on startup. Guard the nil case so the loader logs a warning and skips the bad file. --- weed/admin/dash/config_persistence.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weed/admin/dash/config_persistence.go b/weed/admin/dash/config_persistence.go index 63d6bcdcc..fa3a0b43d 100644 --- a/weed/admin/dash/config_persistence.go +++ b/weed/admin/dash/config_persistence.go @@ -1088,6 +1088,10 @@ func (cp *ConfigPersistence) loadTaskStateLocked(taskID string) (*maintenance.Ma return nil, fmt.Errorf("failed to unmarshal task state protobuf: %w", err) } + if taskStateFile.Task == nil { + return nil, fmt.Errorf("task state file %s contains no task data", taskID) + } + // Convert protobuf to maintenance task task := cp.protobufToMaintenanceTask(taskStateFile.Task)