{"record":{"id":"3516a584ca276d77","repo":"AlistGo/alist","slug":"not-logged-in-yet-please-fill-verify-code-and-sav","errorCode":null,"errorMessage":"not logged in yet: please fill verify_code and save storage to finish SMS login","messagePattern":"not logged in yet: please fill verify_code and save storage to finish SMS login","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"drivers/guangyapan/driver.go","lineNumber":536,"sourceCode":"\t\t}\n\t}\n\n\tif parentID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"resolve root folder path failed: folder %q not found under /\", name)\n\t}\n\treturn \"\", fmt.Errorf(\"resolve root folder path failed: folder %q not found under parent %s\", name, parentID)\n}\n\nfunc (d *GuangYaPan) ensureAccessToken(ctx context.Context) error {\n\tif strings.TrimSpace(d.AccessToken) != \"\" {\n\t\treturn nil\n\t}\n\tif strings.TrimSpace(d.RefreshToken) == \"\" {\n\t\tif d.canSMSLogin() {\n\t\t\treturn d.loginBySMSCode(ctx)\n\t\t}\n\t\tif d.PhoneNumber != \"\" {\n\t\t\treturn errors.New(\"not logged in yet: please fill verify_code and save storage to finish SMS login\")\n\t\t}\n\t\treturn errors.New(\"access token is empty\")\n\t}\n\treturn d.refreshToken(ctx)\n}\n\nfunc (d *GuangYaPan) validateToken(ctx context.Context) error {\n\tvar me userMeResp\n\tresp, err := d.accountClient.R().\n\t\tSetContext(ctx).\n\t\tSetHeader(\"Authorization\", \"Bearer \"+d.AccessToken).\n\t\tSetResult(&me).\n\t\tGet(\"/v1/user/me\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.IsError() {\n\t\treturn fmt.Errorf(\"validate token failed: status=%d body=%s\", resp.StatusCode(), resp.String())","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L518-L554","documentation":"GuangYaPan ensureAccessToken: the access token is empty, there is no refresh token, SMS login is not fully configured (canSMSLogin() false), but a PhoneNumber is present. This means the user started SMS login but has not supplied the verification code — the driver tells them to fill verify_code and re-save the storage to finish.","triggerScenarios":"Any file operation (List, Put, Remove...) invoked when the storage config has phone_number set but verify_code/captcha_token missing and no tokens stored; ensureAccessToken routes into the SMS-incomplete branch.","commonSituations":"Two-step SMS login abandoned halfway: the code was sent (send_code=true), the user closed the dialog, then browsed the mount; captcha token expired making canSMSLogin false while phone_number lingers.","solutions":["Complete SMS login: fill verify_code (and a fresh captcha_token if expired) and save the storage","Re-trigger code sending with send_code=true if the SMS expired","Prefer a long-lived access_token or refresh_token in the config to avoid repeated SMS logins","Ensure captcha/meta fields are valid — expired captcha makes the SMS path unavailable"],"exampleFix":"// before: config state\nphone_number: \"13800138000\"\nverify_code: \"\" // -> every op fails with this error\n// after\nphone_number: \"13800138000\"\nverify_code: \"123456\"\ncaptcha_token: \"<fresh token>\"","handlingStrategy":"validation","validationCode":"// Before operations, ensure the storage can authenticate\nif strings.TrimSpace(d.AccessToken) == \"\" && strings.TrimSpace(d.RefreshToken) == \"\" {\n\tif d.PhoneNumber != \"\" && (d.VerifyCode == \"\" || d.CaptchaToken == \"\") {\n\t\treturn errors.New(\"SMS login incomplete: fill verify_code (and captcha_token) then save the storage\")\n\t}\n}\n// proceed with the operation","typeGuard":"func smsComplete(d *GuangYaPan) bool {\n\treturn d.PhoneNumber != \"\" && d.VerifyCode != \"\" && d.CaptchaToken != \"\"\n}","tryCatchPattern":"if err := op(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"not logged in yet\") {\n\t\t// stop retrying; prompt the user to finish SMS login in storage settings\n\t\treturn errors.New(\"action blocked until SMS login is completed in storage settings\")\n\t}\n\treturn err\n}","preventionTips":["Finish the SMS login flow in one session: captcha -> send_code -> verify_code -> save","Prefer storing a refresh_token so logins outlive codes","Refresh the captcha token if it expires mid-flow","Treat 'not logged in yet' as a configuration signal — retries cannot fix it"],"tags":["guangyapan","authentication","sms","login","configuration"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}