{"record":{"id":"a69f31995b1052bc","repo":"AlistGo/alist","slug":"init-mediafire-critical-missing-cookie","errorCode":null,"errorMessage":"Init :: [MediaFire] {critical} missing Cookie","messagePattern":"Init :: \\[MediaFire\\] (.+?) missing Cookie","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"drivers/mediafire/driver.go","lineNumber":58,"sourceCode":"\tsecChUaPlatform string\n\tuserAgent       string\n}\n\nfunc (d *Mediafire) Config() driver.Config {\n\treturn config\n}\n\nfunc (d *Mediafire) GetAddition() driver.Additional {\n\treturn &d.Addition\n}\n\nfunc (d *Mediafire) Init(ctx context.Context) error {\n\tif d.SessionToken == \"\" {\n\t\treturn fmt.Errorf(\"Init :: [MediaFire] {critical} missing sessionToken\")\n\t}\n\n\tif d.Cookie == \"\" {\n\t\treturn fmt.Errorf(\"Init :: [MediaFire] {critical} missing Cookie\")\n\t}\n\n\tif _, err := d.getSessionToken(ctx); err != nil {\n\n\t\td.renewToken(ctx)\n\n\t\tnum := rand.Intn(4) + 6\n\n\t\td.cron = cron.NewCron(time.Minute * time.Duration(num))\n\t\td.cron.Do(func() {\n\t\t\td.renewToken(ctx)\n\t\t})\n\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/mediafire/driver.go#L40-L76","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["From a logged-in browser session on mediafire.com, copy the full Cookie request header value into the storage's cookie field","Make sure both Cookie and SessionToken are set before saving the storage","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func hasCookie(c string) bool {\n    return strings.TrimSpace(c) != \"\" && strings.Contains(c, \"=\")\n}\n// in Init:\nif !hasCookie(d.Cookie) { return fmt.Errorf(\"cookie is required and must look like 'name=value; ...'\") }","typeGuard":null,"tryCatchPattern":"No catch — Init failing is the correct behavior. Surface a clear message naming the missing field so configuration can be fixed at the source.","preventionTips":["Always copy the complete Cookie request header, not individual cookies","Extract Cookie and SessionToken in the same browser session so they match","Re-check both fields after any config import/export"],"tags":["mediafire","configuration","authentication","cookies","driver-init"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}