AlistGo/alist · critical

Init :: [MediaFire] {critical} missing sessionToken

Error message

Init :: [MediaFire] {critical} missing sessionToken

What it means

Mediafire driver Init aborts because the Addition struct has an empty SessionToken. The driver is a scraping-style client that authenticates with a pre-obtained session token plus browser Cookie; without it, no API call can be signed. Init returns this error, which the driver framework surfaces as storage initialization failure.

Source

Thrown at drivers/mediafire/driver.go:54

	hostBase   string
	maxRetries int

	secChUa         string
	secChUaPlatform string
	userAgent       string
}

func (d *Mediafire) Config() driver.Config {
	return config
}

func (d *Mediafire) GetAddition() driver.Additional {
	return &d.Addition
}

func (d *Mediafire) Init(ctx context.Context) error {
	if d.SessionToken == "" {
		return fmt.Errorf("Init :: [MediaFire] {critical} missing sessionToken")
	}

	if d.Cookie == "" {
		return fmt.Errorf("Init :: [MediaFire] {critical} missing Cookie")
	}

	if _, err := d.getSessionToken(ctx); err != nil {

		d.renewToken(ctx)

		num := rand.Intn(4) + 6

		d.cron = cron.NewCron(time.Minute * time.Duration(num))
		d.cron.Do(func() {
			d.renewToken(ctx)
		})

	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Open mediafire.com logged in, extract session_token (and cookie) from browser devtools and fill both fields in the storage config
  2. Verify the saved storage JSON actually contains the token (it is persisted via op.MustSaveDriverStorage)
  3. Re-save the storage config after pasting so Init runs again with the populated Addition
Defensive patterns

Strategy: validation

Validate before calling

func (d *Mediafire) Init(ctx context.Context) error {
    if strings.TrimSpace(d.SessionToken) == "" {
        return fmt.Errorf("sessionToken is required: extract it from a logged-in mediafire.com browser session")
    }
    ...
}

Try / catch

The framework already surfaces Init errors in the storage status UI — catch nothing; instead present actionable text in the error so the admin knows which field to fill.

Prevention

When it happens

Trigger: Adding a MediaFire storage in the admin UI without pasting a session token; restoring a storage config from JSON where the session_token field was dropped; the token never having been persisted (MustSaveDriverStorage not yet run on first setup).

Common situations: First-time setup where the user filled Cookie but skipped extracting the session_token from the browser; migrating configs between instances; secret fields stripped during config export.

Related errors


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