{"record":{"id":"2a0ae32bca0a2b8a","repo":"AlistGo/alist","slug":"s3-transition-task-manager-is-not-initialized","errorCode":null,"errorMessage":"s3 transition task manager is not initialized","messagePattern":"s3 transition task manager is not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fs/other.go","lineNumber":67,"sourceCode":"\tstorage, actualPath, err := op.GetStorageAndActualPath(path)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed get storage\")\n\t}\n\treturn op.Remove(ctx, storage, actualPath)\n}\n\nfunc other(ctx context.Context, args model.FsOtherArgs) (interface{}, error) {\n\tstorage, actualPath, err := op.GetStorageAndActualPath(args.Path)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"failed get storage\")\n\t}\n\toriginalPath := args.Path\n\n\tif _, ok := storage.(*s3.S3); ok {\n\t\tmethod := strings.ToLower(strings.TrimSpace(args.Method))\n\t\tif method == s3.OtherMethodArchive || method == s3.OtherMethodThaw {\n\t\t\tif S3TransitionTaskManager == nil {\n\t\t\t\treturn nil, errors.New(\"s3 transition task manager is not initialized\")\n\t\t\t}\n\t\t\tvar payload json.RawMessage\n\t\t\tif args.Data != nil {\n\t\t\t\traw, err := json.Marshal(args.Data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.WithMessage(err, \"failed to encode request payload\")\n\t\t\t\t}\n\t\t\t\tpayload = raw\n\t\t\t}\n\t\t\ttaskCreator, _ := ctx.Value(\"user\").(*model.User)\n\t\t\ttsk := &S3TransitionTask{\n\t\t\t\tTaskExtension:    task.TaskExtension{Creator: taskCreator},\n\t\t\t\tstatus:           \"queued\",\n\t\t\t\tStorageMountPath: storage.GetStorage().MountPath,\n\t\t\t\tObjectPath:       actualPath,\n\t\t\t\tDisplayPath:      originalPath,\n\t\t\t\tObjectName:       stdpath.Base(actualPath),\n\t\t\t\tTransition:       method,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/fs/other.go#L49-L85","documentation":"Returned by internal/fs/other.go when an fs 'other' request targets an S3 storage with method 'archive' or 'thaw' (S3 Glacier transition) but the package-level S3TransitionTaskManager is still nil. The manager is a tache task manager initialized during bootstrap (internal/bootstrap/task.go:44); the check guards against submitting tasks before that init has run.","triggerScenarios":"Calling the /api/fs/other endpoint with method=archive|thaw on an S3-mounted path before bootstrap completed, or from code paths (tests, early startup hooks, embedded usage) that link internal/fs without running the bootstrap sequence that assigns fs.S3TransitionTaskManager.","commonSituations":"Unit tests or tooling importing internal/fs directly and calling other() without bootstrap; a race during process startup where HTTP serving begins before task managers register; custom builds that skip the task bootstrap step. In a normally started server it should never fire.","solutions":["Ensure the full bootstrap sequence (including internal/bootstrap/task.go) runs before serving requests or invoking fs.Other","In tests/embedding, initialize fs.S3TransitionTaskManager with tache.NewManager the same way bootstrap does","If seen in production, check startup logs for bootstrap panics that aborted initialization"],"exampleFix":"// before\nres, err := fs.Other(ctx, args) // S3TransitionTaskManager may be nil in tests\n\n// after\nfs.S3TransitionTaskManager = tache.NewManager[*fs.S3TransitionTask](func(t *fs.S3TransitionTask) error { return t.Run() })\nres, err := fs.Other(ctx, args)","handlingStrategy":"validation","validationCode":"// ensure bootstrap task init ran before handling S3 other-methods\nif fs.S3TransitionTaskManager == nil {\n    return errors.New(\"task system not ready; finish bootstrap first\")\n}","typeGuard":"func s3TransitionReady() bool {\n    return fs.S3TransitionTaskManager != nil\n}","tryCatchPattern":"res, err := fs.Other(ctx, args)\nif err != nil && strings.Contains(err.Error(), \"not initialized\") {\n    // re-run bootstrap or defer the request; not a client error\n}","preventionTips":["Run the full bootstrap sequence before serving HTTP","In tests, construct the manager like internal/bootstrap/task.go does","Fail fast at startup if task managers are nil","Do not call internal/fs from tools that skip bootstrap"],"tags":["s3","glacier","task-manager","bootstrap"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}