AlistGo/alist · error

file_id is required

Error message

file_id is required

What it means

Returned by Terabox.Put (drivers/terabox/driver.go:268) when the final /api/create call (which commits the uploaded chunks) reports errno != 0. All chunks were already transferred, so a failure here usually means the commit was rejected server-side, potentially leaving a partial state.

Source

Thrown at drivers/123_open/other.go:142

	if err != nil {
		return fmt.Errorf("encode arguments: %w", err)
	}
	if err := utils.Json.Unmarshal(raw, target); err != nil {
		return fmt.Errorf("decode arguments: %w", err)
	}
	return nil
}

// resolveFileID prefers an explicitly passed id and falls back to the object
// the request was addressed to.
func resolveFileID(args model.OtherArgs, explicit int64) (int64, error) {
	if explicit != 0 {
		return explicit, nil
	}
	if args.Obj != nil {
		return parseFileID(args.Obj.GetID())
	}
	return 0, errors.New("file_id is required")
}

// resolveFileIDs falls back to the addressed object when no list was given.
func resolveFileIDs(args model.OtherArgs, explicit []int64) ([]int64, error) {
	if len(explicit) > 0 {
		return explicit, nil
	}
	if args.Obj == nil {
		return nil, errors.New("file_ids is required")
	}
	id, err := parseFileID(args.Obj.GetID())
	if err != nil {
		return nil, err
	}
	return []int64{id}, nil
}

// Shared request and response shapes.

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry the upload end-to-end after refreshing the storage session (Init) — most transient/session causes resolve.
  2. Verify the source file is not being modified during upload (stable md5s), and re-put.
  3. Check the destination folder still exists and quota is sufficient.
  4. If errno indicates the file already exists and overwrite semantics matter, handle the exists case explicitly instead of relying on the raw error.

Example fix

// before
if createResp.Errno != 0 {
	return fmt.Errorf("[terabox] failed to create file, errno: %d", createResp.Errno)
}

// after: refresh session and retry once on transient errno
if createResp.Errno != 0 {
	if isTransientErrno(createResp.Errno) && attempt < maxAttempts {
		_ = d.Init(ctx) // refresh jsToken/session
		attempt++
		continue // restart upload loop
	}
	return fmt.Errorf("[terabox] failed to create file, errno: %d", createResp.Errno)
}
Defensive patterns

Strategy: retry

Type guard

func isTeraboxCreateErr(err error) bool {
	return err != nil && strings.Contains(err.Error(), "failed to create file")
}

Try / catch

err := d.Put(ctx, dstDir, file, overwrite, session)
if isTeraboxCreateErr(err) {
	_ = d.Init(ctx) // refresh session
	err = d.Put(ctx, dstDir, file, overwrite, session) // one retry
}

Prevention

When it happens

Trigger: Block list mismatch between precreate and create (corrupted chunk md5s); target path became invalid mid-upload; quota hit between precreate and create; session/jsToken expiry during a long upload; server-side dedupe or rapid-upload rejection.

Common situations: Very large uploads over slow links outliving the jsToken validity; source file modified while being read causing md5 drift; concurrent writes to the same target; transient Terabox backend errors.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/3a6ad85fb7228425. Report an issue: GitHub.