AlistGo/alist · critical

Init :: [MediaFire] {critical} missing Cookie

Error message

Init :: [MediaFire] {critical} missing Cookie

What it means

Mediafire driver Init aborts because the Cookie field is empty. getSessionToken sends d.Cookie verbatim in the Cookie header, so without the browser cookie MediaFire's get_session_token endpoint will not mint a session token. Checked immediately after the SessionToken check, with the same critical severity and the same storage-init failure effect.

Source

Thrown at drivers/mediafire/driver.go:58

	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)
		})

	}

	return nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. From a logged-in browser session on mediafire.com, copy the full Cookie request header value into the storage's cookie field
  2. Make sure both Cookie and SessionToken are set before saving the storage
  3. If the cookie was expired, grab a fresh one and also re-extract the session token since the old one will fail getSessionToken (error 876/875 follow otherwise)
Defensive patterns

Strategy: validation

Validate before calling

func hasCookie(c string) bool {
    return strings.TrimSpace(c) != "" && strings.Contains(c, "=")
}
// in Init:
if !hasCookie(d.Cookie) { return fmt.Errorf("cookie is required and must look like 'name=value; ...'") }

Try / catch

No catch — Init failing is the correct behavior. Surface a clear message naming the missing field so configuration can be fixed at the source.

Prevention

When it happens

Trigger: Storage configured with only a session token and no cookie; cookie field cleared during a config edit; copy-paste of the cookie failed silently (trailing newline or empty string).

Common situations: Users extract the token but not the cookie, or the cookie expired and was manually deleted instead of refreshed; older guides describing a cookie-less setup that MediaFire's endpoint no longer permits.

Related errors


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