AlistGo/alist · error
create folder failed: %w
Error message
create folder failed: %w
What it means
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.
Source
Thrown at drivers/darkibox/driver.go:165
}
return &model.Link{
URL: dlURL,
}, nil
}
func (d *Darkibox) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {
parentID := d.RootFolderID
if parentDir.GetID() != "" {
parentID = folderIDFromObjID(parentDir.GetID())
}
var result folderCreateResult
if err := d.callAPI(ctx, "/folder/create", map[string]string{
"name": dirName,
"parent_id": fldIDStr(parentID),
}, &result); err != nil {
return nil, fmt.Errorf("create folder failed: %w", err)
}
return &model.Object{
ID: encodeFolderID(result.FldID),
Name: dirName,
IsFolder: true,
}, nil
}
func (d *Darkibox) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {
if srcObj.IsDir() {
return nil, errs.NotImplement
}
fileCode := fileCodeFromObjID(srcObj.GetID())
if fileCode == "" {
return nil, fmt.Errorf("empty file code")
}View on GitHub (pinned to 843d9dc814)
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
Example fix
// before
if err := d.callAPI(ctx, "/folder/create", params, &result); err != nil {
return nil, fmt.Errorf("create folder failed: %w", err)
}
// after — surface the parent ID for easier diagnosis
if err := d.callAPI(ctx, "/folder/create", params, &result); err != nil {
return nil, fmt.Errorf("create folder %q under %s failed: %w", dirName, parentID, err)
} Defensive patterns
Strategy: try-catch
Validate before calling
if d.APIKey == "" {
return errors.New("darkibox API key not configured")
}
if dirName == "" || strings.ContainsAny(dirName, "/\\") {
return errors.New("invalid folder name")
} Type guard
func isValidParentRef(parentDir model.Obj) bool {
id := parentDir.GetID()
return id == "" || folderIDFromObjID(id) != ""
} Try / catch
obj, err := fs.MakeDir(ctx, path)
if err != nil {
if strings.Contains(err.Error(), "create folder failed") {
// inspect wrapped cause: auth vs parent vs provider
log.Warnf("mkdir failed: %v", err)
return retryOrFail(err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- move file failed: %w
- get upload server failed: %w
- error:%s
- upload failed: http %d
- darkibox http error: %d
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/f6036a0907306881.
Report an issue: GitHub.