{"record":{"id":"4ea25075c278d08d","repo":"kataras/iris","slug":"auth-signin-no-provider","errorCode":null,"errorMessage":"auth: signin: no provider","messagePattern":"auth: signin: no provider","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"auth/auth.go","lineNumber":245,"sourceCode":"\tif n := len(s.providers); n > 0 {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tp := s.providers[i]\n\n\t\t\tv, err := p.Signin(ctx, username, password)\n\t\t\tif err != nil {\n\t\t\t\tif i == n-1 { // last provider errored.\n\t\t\t\t\treturn nil, nil, fmt.Errorf(\"auth: signin: %w\", err)\n\t\t\t\t}\n\t\t\t\t// keep searching.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// found.\n\t\t\tt = v\n\t\t\tbreak\n\t\t}\n\t} else {\n\t\treturn nil, nil, fmt.Errorf(\"auth: signin: no provider\")\n\t}\n\n\t// sign the tokens.\n\taccessToken, refreshToken, err := s.sign(t)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"auth: signin: %w\", err)\n\t}\n\n\treturn accessToken, refreshToken, nil\n}\n\nfunc (s *Auth[T]) sign(t T) ([]byte, []byte, error) {\n\t// sign the tokens.\n\tvar (\n\t\taccessStdClaims  StandardClaims\n\t\trefreshStdClaims StandardClaims\n\t)\n","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/auth/auth.go#L227-L263","documentation":"Auth.Signin returns 'auth: signin: no provider' when the Auth instance has no providers registered, so there is nothing to attempt authentication against. This is a configuration error, not a credential failure — the loop over s.providers never runs and the else branch fires. It signals the Auth service was constructed without any Signin providers attached.","triggerScenarios":"Calling Signin/SigninHandler on an Auth[T] built without AddProvider (or equivalent registration) — s.providers is empty so the for-loop is skipped and the else branch errors.","commonSituations":"Forgetting to register any auth provider during wiring; conditional registration code that never executes (e.g. env-based setup skipped); constructing Auth in tests without providers.","solutions":["Register at least one provider (e.g. a database-backed provider) before serving auth routes","Check that provider-registration code actually runs (no early return / env guard skipping it)","Add a startup assertion that len(providers) > 0 to fail fast at boot"],"exampleFix":"// before\nauth := iris.NewAuth(jwtSigner) // no providers\n// after\nauth := iris.NewAuth(jwtSigner)\nauth.AddProvider(dbProvider)","handlingStrategy":"validation","validationCode":"// fail fast at boot\nif len(a.Providers()) == 0 {\n    log.Fatal(\"auth: no signin providers registered\")\n}","typeGuard":"func isNoProviderErr(err error) bool { return err != nil && strings.Contains(err.Error(), \"auth: signin: no provider\") }","tryCatchPattern":"if _, _, err := a.Signin(ctx, user, pass); err != nil {\n    if strings.Contains(err.Error(), \"no provider\") {\n        return http.StatusServiceUnavailable // server misconfig, not user error\n    }\n    return http.StatusUnauthorized\n}","preventionTips":["Register providers during DI wiring and assert at startup","Avoid env guards that silently skip provider registration","Cover Auth construction in integration tests"],"tags":["auth","configuration","providers"],"backgroundTag":"no-auth-provider-configured","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}