{"record":{"id":"ed8074107e100fe2","repo":"AlistGo/alist","slug":"create-offline-task-failed-s","errorCode":null,"errorMessage":"create offline task failed: %s","messagePattern":"create offline task failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/offline.go","lineNumber":73,"sourceCode":"\tif name == \"\" {\n\t\tname = resolved.defaultName(taskURL)\n\t}\n\n\tbody := map[string]any{\n\t\t\"url\":      taskURL,\n\t\t\"parentId\": parentID,\n\t\t\"newName\":  name,\n\t}\n\tif indexes := resolved.fileIndexes(); len(indexes) > 0 {\n\t\tbody[\"fileIndexes\"] = indexes\n\t}\n\n\tvar resp offlineCreateResp\n\tif err := d.postAPI(ctx, \"/cloudcollection/v1/create_task\", body, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif !isSuccessMsg(resp.Msg) {\n\t\treturn nil, fmt.Errorf(\"create offline task failed: %s\", strings.TrimSpace(resp.Msg))\n\t}\n\ttaskID := strings.TrimSpace(resp.Data.TaskID)\n\tif taskID == \"\" {\n\t\treturn nil, errors.New(\"create offline task failed: empty task id\")\n\t}\n\treturn &OfflineTask{\n\t\tTaskID:   taskID,\n\t\tFileName: name,\n\t\tRes:      taskURL,\n\t}, nil\n}\n\nfunc (d *GuangYaPan) OfflineList(ctx context.Context, taskIDs []string, statuses []int, cursor string, pageSize int) ([]OfflineTask, error) {\n\tif err := d.ensureAccessToken(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tbody := map[string]any{}\n\tif len(taskIDs) > 0 {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/offline.go#L55-L91","documentation":"OfflineDownload's final step POSTs the resolved task URL, parentId, and newName to /cloudcollection/v1/create_task; this error means the HTTP call succeeded but the envelope Msg was not 'success'. (A separate empty-task-id error covers a success response with no TaskID.) The provider refused to queue the offline download.","triggerScenarios":"create_task rejected because the target folder is invalid/deleted, the offline task quota is full, duplicate task for the same URL, or content the provider blocks; a separate empty-task-id error covers success-with-no-ID.","commonSituations":"Too many pending offline tasks; offline-download feature restricted on the account plan; parentDir resolved to a folder that no longer exists; the same link already queued.","solutions":["Read the embedded Msg - quota/duplicate messages are self-explanatory; clear finished tasks and retry.","Confirm the target folder exists and is writable.","Delete an existing duplicate task for the same URL before re-adding."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before creating a task, confirm the target folder is valid\nif parentDir == nil || parentDir.GetID() == \"\" && parentDir.GetPath() != \"/\" {\n    return errors.New(\"invalid target folder for offline download\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := d.OfflineDownload(ctx, fileURL, parentDir, fileName); err != nil {\n    if strings.Contains(err.Error(), \"create offline task failed\") {\n        msg := err.Error()\n        if strings.Contains(msg, \"exist\") || strings.Contains(msg, \"duplicate\") {\n            // duplicate/existing task: harmless, treat as queued\n            return nil\n        }\n        if strings.Contains(msg, \"quota\") || strings.Contains(msg, \"limit\") {\n            return errors.New(\"offline task quota exceeded - clean up finished tasks\")\n        }\n    }\n    return err\n}","preventionTips":["Periodically clear completed offline tasks to stay under quota.","Do not queue the same URL twice.","Verify the target folder exists right before task creation."],"tags":["offline-download","task-creation","quota","guangyapan"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}