{"record":{"id":"4e3c8c966f951518","repo":"goharbor/harbor","slug":"invalid-database-s","errorCode":null,"errorMessage":"invalid database: %s","messagePattern":"invalid database: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/common/dao/base.go","lineNumber":92,"sourceCode":"func getDatabase(database *models.Database) (db Database, err error) {\n\tswitch database.Type {\n\tcase \"\", \"postgresql\":\n\t\tdb = NewPGSQL(\n\t\t\tdatabase.PostGreSQL.Host,\n\t\t\tstrconv.Itoa(database.PostGreSQL.Port),\n\t\t\tdatabase.PostGreSQL.Username,\n\t\t\tdatabase.PostGreSQL.Password,\n\t\t\tdatabase.PostGreSQL.Database,\n\t\t\tdatabase.PostGreSQL.SSLMode,\n\t\t\tdatabase.PostGreSQL.MaxIdleConns,\n\t\t\tdatabase.PostGreSQL.MaxOpenConns,\n\t\t\tdatabase.PostGreSQL.ConnMaxLifetime,\n\t\t\tdatabase.PostGreSQL.ConnMaxIdleTime,\n\t\t)\n\tdefault:\n\t\terr = fmt.Errorf(\"invalid database: %s\", database.Type)\n\t}\n\treturn\n}","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/common/dao/base.go#L74-L110","documentation":"Configuration validation in getDatabase: the switch over database.Type only accepts '' or 'postgresql'; any other configured type (e.g. a leftover mysql setting) produces this sentinel error at startup, before any connection is attempted. A guard against unsupported configuration input.","triggerScenarios":"Thrown at src/common/dao/base.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the database type in harbor.yml to 'postgresql' (or leave it empty for the default)","Remove legacy mysql database configuration from harbor.yml","Re-run install/prepare after fixing the configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}