{"record":{"id":"6076e8647ff15de3","repo":"AlistGo/alist","slug":"verify-code-failed-s","errorCode":null,"errorMessage":"verify code failed: %s","messagePattern":"verify code failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/driver.go","lineNumber":630,"sourceCode":"\t\t\treturn err\n\t\t}\n\t}\n\n\tvar step2 verifyResp\n\tresp, err := d.accountClient.R().\n\t\tSetContext(ctx).\n\t\tSetBody(map[string]any{\n\t\t\t\"verification_id\":   verificationID,\n\t\t\t\"verification_code\": d.VerifyCode,\n\t\t\t\"client_id\":         d.ClientID,\n\t\t}).\n\t\tSetResult(&step2).\n\t\tPost(\"/v1/auth/verification/verify\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.IsError() || step2.Error != \"\" || strings.TrimSpace(step2.VerificationToken) == \"\" {\n\t\treturn fmt.Errorf(\"verify code failed: %s\", d.accountErr(step2.ErrorDesc, step2.Error, resp))\n\t}\n\n\tvar out tokenResp\n\tresp, err = d.accountClient.R().\n\t\tSetContext(ctx).\n\t\tSetBody(map[string]any{\n\t\t\t\"verification_code\":  d.VerifyCode,\n\t\t\t\"verification_token\": step2.VerificationToken,\n\t\t\t\"username\":           normalizePhoneE164(d.PhoneNumber),\n\t\t\t\"client_id\":          d.ClientID,\n\t\t}).\n\t\tSetResult(&out).\n\t\tPost(\"/v1/auth/signin\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.IsError() || out.Error != \"\" || strings.TrimSpace(out.AccessToken) == \"\" {\n\t\treturn fmt.Errorf(\"signin failed: %s\", d.accountErr(out.ErrorDesc, out.Error, resp))","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L612-L648","documentation":"Second step of SMS login: the driver POSTs verification_id + verification_code to /v1/auth/verification/verify and throws when the response is an HTTP error, has an error field, or the returned VerificationToken is empty. The detail comes from accountErr (ErrorDesc, then Error, then response body).","triggerScenarios":"loginBySMSCode runs with a wrong, expired, or already-used verify_code; the verification_id from prepareSMSCode expired; captcha requirement not satisfied; provider returns a non-2xx or an error payload.","commonSituations":"User reuses a one-time SMS code (the driver clears VerifyCode only after successful signin); too much time elapsed between requesting and submitting the code; the code was requested for a different phone number.","solutions":["Request a new SMS code and enter it promptly (complete the flow within its validity window).","Ensure phone_number matches the number the SMS was sent to.","If the error mentions captcha, let prepareSMSCode/ensureCaptchaToken refresh the captcha token and retry the whole login."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before attempting SMS login\nif d.PhoneNumber == \"\" || d.VerifyCode == \"\" {\n    return errors.New(\"phone_number and verify_code are both required for SMS login\")\n}\nif len(d.VerifyCode) < 4 || !isAllDigits(d.VerifyCode) {\n    return errors.New(\"verify_code looks malformed\")\n}","typeGuard":null,"tryCatchPattern":"if err := d.loginBySMSCode(ctx); err != nil {\n    if strings.Contains(err.Error(), \"verify code failed\") {\n        // code is wrong/expired: get a NEW code, do not retry the same one\n        return errors.New(\"SMS code rejected - request a new code and re-enter it\")\n    }\n    return err\n}","preventionTips":["Treat SMS codes as strictly one-shot: never retry with the same code.","Complete login within the code's validity window.","Clear stale verify_code from config after login attempts."],"tags":["auth","sms-login","verify-code","guangyapan"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}