{"record":{"id":"350c0bb5074311e8","repo":"ory/kratos","slug":"dsn-must-be-set","errorCode":null,"errorMessage":"dsn must be set","messagePattern":"dsn must be set","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"driver/config/config.go","lineNumber":669,"sourceCode":"\t}\n\n\treturn ss, nil\n}\n\nfunc (p *Config) DSN(ctx context.Context) string {\n\tpp := p.GetProvider(ctx)\n\tdsn := pp.String(ViperKeyDSN)\n\n\tif dsn == \"memory\" {\n\t\treturn DefaultSQLiteMemoryDSN\n\t}\n\n\tif len(dsn) > 0 {\n\t\treturn dsn\n\t}\n\n\t// Print a stack trace to aid debugging.\n\tp.l.Fatalf(\"%+v\", errors.Errorf(\"dsn must be set\"))\n\treturn \"\"\n}\n\nfunc (p *Config) DisableAPIFlowEnforcement(ctx context.Context) bool {\n\tif p.IsInsecureDevMode(ctx) && os.Getenv(\"DEV_DISABLE_API_FLOW_ENFORCEMENT\") == \"true\" {\n\t\tp.l.Warn(\"Because \\\"DEV_DISABLE_API_FLOW_ENFORCEMENT=true\\\" and the \\\"--dev\\\" flag are set, self-service API flows will no longer check if the interaction is actually a browser flow. This is very dangerous as it allows bypassing of anti-CSRF measures, leaving the deployment highly vulnerable. This option should only be used for automated testing and never come close to real user data anywhere.\")\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (p *Config) ClientHTTPNoPrivateIPRanges(ctx context.Context) bool {\n\treturn p.GetProvider(ctx).BoolF(ViperKeyClientHTTPNoPrivateIPRanges, false)\n}\n\nfunc (p *Config) ClientHTTPPrivateIPExceptionURLs(ctx context.Context) []string {\n\treturn p.GetProvider(ctx).Strings(ViperKeyClientHTTPPrivateIPExceptionURLs)\n}","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/driver/config/config.go#L651-L687","documentation":"Config.DSN found neither 'memory' nor any non-empty DSN value in the active configuration, so no database connection string exists. This path calls l.Fatalf, so it terminates the process after printing a stack trace to aid debugging.","triggerScenarios":"Thrown at driver/config/config.go:669 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the dsn key in the kratos configuration file (e.g. DSN: postgres://...)","Provide the DSN via the environment variable or CLI flag your deployment maps to ViperKeyDSN","Use 'memory' for local testing if a real database is not needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}