{"record":{"id":"16c3ebb964eb6c19","repo":"FreshRSS/FreshRSS","slug":"invalid-database-type","errorCode":null,"errorMessage":"Invalid database type!","messagePattern":"Invalid database type!","errorType":"exception","errorClass":"Minz_PDOConnectionException","httpStatus":500,"severity":"critical","filePath":"lib/Minz/ModelPdo.php","lineNumber":90,"sourceCode":"\t\t\t\t} else {\n\t\t\t\t\t$dsn = 'sqlite:' . DATA_PATH . '/users/' . $this->current_user . '/db.sqlite';\n\t\t\t\t}\n\t\t\t\t$this->pdo = new Minz_PdoSqlite($dsn . $dsnParams, null, null, $driver_options);\n\t\t\t\t$this->pdo->setPrefix('');\n\t\t\t\tbreak;\n\t\t\tcase 'pgsql':\n\t\t\t\t$dsn = 'pgsql:host=' . (empty($dbServer['host']) ? $db['host'] : $dbServer['host']);\n\t\t\t\tif (!empty($db['base'])) {\n\t\t\t\t\t$dsn .= ';dbname=' . $db['base'];\n\t\t\t\t}\n\t\t\t\tif (!empty($dbServer['port'])) {\n\t\t\t\t\t$dsn .= ';port=' . $dbServer['port'];\n\t\t\t\t}\n\t\t\t\t$this->pdo = new Minz_PdoPgsql($dsn . $dsnParams, $db['user'], $db['password'], $driver_options);\n\t\t\t\t$this->pdo->setPrefix($db['prefix'] . $this->current_user . '_');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Minz_PDOConnectionException('Invalid database type!', is_string($db['user'] ?? null) ? $db['user'] : '', Minz_Exception::ERROR);\n\t\t}\n\t\tif (self::$usesSharedPdo) {\n\t\t\tself::$sharedPdo = $this->pdo;\n\t\t}\n\t}\n\n\t/**\n\t * Create the connection to the database using the variables\n\t * HOST, BASE, USER and PASS variables defined in the configuration file\n\t * @throws Minz_ConfigurationException\n\t * @throws Minz_PDOConnectionException\n\t */\n\tpublic function __construct(?string $currentUser = null, ?Minz_Pdo $currentPdo = null) {\n\t\tif ($currentUser === null) {\n\t\t\t$currentUser = Minz_User::name();\n\t\t}\n\t\tif ($currentPdo !== null) {\n\t\t\t$this->pdo = $currentPdo;","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/FreshRSS/FreshRSS/blob/95842d81c1b8ab673389544f072559aeb8cd7591/lib/Minz/ModelPdo.php#L72-L108","documentation":"Minz_ModelPdo::dbConnect() switches on the 'type' entry of the system db configuration and only implements 'sqlite', 'mysql', and 'pgsql' (each constructing the matching Minz_Pdo* subclass with prefix handling). Any other value falls through to Minz_PDOConnectionException('Invalid database type!') carrying the configured DB user, so the connection never opens.","triggerScenarios":"data/config.php contains db 'type' => 'postgres', 'mariadb', 'MySQL', or an empty/null value from a broken config; hand-written config after migrating from another tool; a config produced by an incompatible FreshRSS version or a templating typo in a container image.","commonSituations":"Hand-editing config during MySQL-to-PostgreSQL moves; docker/ansible templates substituting the wrong type string; partially restored data/config.php.","solutions":["Set db.type in data/config.php to exactly one of: sqlite, mysql, pgsql","Start from config.default.php and re-apply only documented overrides instead of hand-writing the whole file","After editing, restart php-fpm/web server so no opcode or config cache serves the old value"],"exampleFix":"// data/config.php\n// before\n'db' => ['type' => 'postgres', 'host' => 'db1', ...],\n\n// after\n'db' => ['type' => 'pgsql', 'host' => 'db1', ...],","handlingStrategy":"validation","validationCode":"$db = Minz_Configuration::get('system')->db;\nif (!in_array($db['type'], ['sqlite', 'mysql', 'pgsql'], true)) {\n\t// refuse to bootstrap with an unknown type; show a config error instead of a PDO exception\n\tthrow new RuntimeException('Unsupported db.type: ' . $db['type']);\n}","typeGuard":"function isSupportedDatabaseType(mixed $type): bool {\n\treturn is_string($type) && in_array($type, ['sqlite', 'mysql', 'pgsql'], true);\n}","tryCatchPattern":null,"preventionTips":["When hand-editing data/config.php, use exactly sqlite/mysql/pgsql - not 'postgres' or 'mariadb'","Start edits from config.default.php so keys and value sets stay valid","Validate db.type in deployment tooling before bringing FreshRSS up","Restart php-fpm after config changes to avoid stale cached configuration"],"tags":["minz","database","pdo","configuration","bootstrap"],"backgroundTag":"unsupported-database-type","analyzedSha":"95842d81c1b8ab673389544f072559aeb8cd7591","analyzedAt":"2026-08-23T00:21:00.265Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}