{"record":{"id":"f6036a0907306881","repo":"AlistGo/alist","slug":"create-folder-failed-w","errorCode":null,"errorMessage":"create folder failed: %w","messagePattern":"create folder failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/darkibox/driver.go","lineNumber":165,"sourceCode":"\t}\n\n\treturn &model.Link{\n\t\tURL: dlURL,\n\t}, nil\n}\n\nfunc (d *Darkibox) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {\n\tparentID := d.RootFolderID\n\tif parentDir.GetID() != \"\" {\n\t\tparentID = folderIDFromObjID(parentDir.GetID())\n\t}\n\n\tvar result folderCreateResult\n\tif err := d.callAPI(ctx, \"/folder/create\", map[string]string{\n\t\t\"name\":      dirName,\n\t\t\"parent_id\": fldIDStr(parentID),\n\t}, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"create folder failed: %w\", err)\n\t}\n\n\treturn &model.Object{\n\t\tID:       encodeFolderID(result.FldID),\n\t\tName:     dirName,\n\t\tIsFolder: true,\n\t}, nil\n}\n\nfunc (d *Darkibox) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {\n\tif srcObj.IsDir() {\n\t\treturn nil, errs.NotImplement\n\t}\n\n\tfileCode := fileCodeFromObjID(srcObj.GetID())\n\tif fileCode == \"\" {\n\t\treturn nil, fmt.Errorf(\"empty file code\")\n\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/darkibox/driver.go#L147-L183","documentation":"This error is returned by Darkibox driver's MakeDir when the remote /folder/create API call fails. The underlying cause is wrapped (%w) from callAPI, so the real reason (HTTP error, API status error, or JSON decode failure) appears in the error chain. It means the folder was not created on the remote storage.","triggerScenarios":"Calling MakeDir (e.g. mkdir via WebDAV or the 'make folder' operation) while: the API key is invalid/expired (API returns non-200 status), the parent folder ID does not exist on the Darkibox server, the dirName contains characters the API rejects, or the Darkibox endpoint is unreachable/returns malformed JSON.","commonSituations":"Expired or wrong API key configured in the driver Addition; network egress blocked to apiBase; the parent dir object came from a stale listing whose encoded folder ID no longer resolves; rate limiting by the provider.","solutions":["Verify the driver's API key and apiBase in the mount configuration (re-run the connection test)","Inspect the wrapped error chain — 'darkibox api error: status=... msg=...' tells you the provider's own failure reason; fix accordingly (auth, quota, invalid name)","Retry the mkdir against the root folder to confirm the parent ID is the problem vs. the key","If the API returns HTML instead of JSON, the endpoint domain changed — check the Darkibox provider docs for the current API base"],"exampleFix":"// before\nif err := d.callAPI(ctx, \"/folder/create\", params, &result); err != nil {\n\treturn nil, fmt.Errorf(\"create folder failed: %w\", err)\n}\n// after — surface the parent ID for easier diagnosis\nif err := d.callAPI(ctx, \"/folder/create\", params, &result); err != nil {\n\treturn nil, fmt.Errorf(\"create folder %q under %s failed: %w\", dirName, parentID, err)\n}","handlingStrategy":"try-catch","validationCode":"if d.APIKey == \"\" {\n\treturn errors.New(\"darkibox API key not configured\")\n}\nif dirName == \"\" || strings.ContainsAny(dirName, \"/\\\\\") {\n\treturn errors.New(\"invalid folder name\")\n}","typeGuard":"func isValidParentRef(parentDir model.Obj) bool {\n\tid := parentDir.GetID()\n\treturn id == \"\" || folderIDFromObjID(id) != \"\"\n}","tryCatchPattern":"obj, err := fs.MakeDir(ctx, path)\nif err != nil {\n\tif strings.Contains(err.Error(), \"create folder failed\") {\n\t\t// inspect wrapped cause: auth vs parent vs provider\n\t\tlog.Warnf(\"mkdir failed: %v\", err)\n\t\treturn retryOrFail(err)\n\t}\n\treturn err\n}","preventionTips":["Keep the API key current and test the connection after config changes","Avoid folder names with slashes or provider-illegal characters","Re-list the parent before mkdir after long idle periods"],"tags":["darkibox","mkdir","api-error","storage-driver"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}