{"record":{"id":"7fde2f169c2258ab","repo":"temporalio/temporal","slug":"error-building-dsn-w","errorCode":null,"errorMessage":"error building DSN: %w","messagePattern":"error building DSN: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/sql/sqlplugin/sqlite/plugin.go","lineNumber":84,"sourceCode":"\t\treturn nil, err\n\t}\n\tdb := newDB(dbKind, cfg.DatabaseName, conn, nil, logger)\n\tdb.OnClose(func() { p.connPool.Close(cfg) }) // remove reference\n\treturn db, nil\n}\n\n// createDBConnection creates a returns a reference to a logical connection to the\n// underlying SQL database. The returned object is tied to a single\n// SQL database and the object can be used to perform CRUD operations on\n// the tables in the database.\nfunc (p *plugin) createDBConnection(\n\tcfg *config.SQL,\n\t_ resolver.ServiceResolver,\n\tlogger log.Logger,\n) (*sqlx.DB, error) {\n\tdsn, err := buildDSN(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building DSN: %w\", err)\n\t}\n\n\tdb, err := sqlx.Connect(goSQLDriverName, dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Connection pool settings.\n\t//\n\t// By default, SQLite only supports a single writer at a time (see\n\t// https://github.com/mattn/go-sqlite3#faq). Without WAL (Write-Ahead Logging)\n\t// mode, concurrent connections will encounter \"database is locked\" errors.\n\t// With WAL mode enabled (journal_mode=wal), SQLite supports concurrent readers\n\t// alongside a single writer, making multiple connections safe and beneficial\n\t// for throughput.\n\t//\n\t// These settings mirror the behavior of the MySQL and PostgreSQL plugins:\n\t// respect the user's config values when set, otherwise default to 1 for","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/sql/sqlplugin/sqlite/plugin.go#L66-L102","documentation":"Wrapped in createDBConnection when buildDSN fails while constructing the SQLite data source name. buildDSN derives the DSN from the SQL config (database file path and ConnectAttributes), so this indicates invalid or missing SQLite configuration. The wrapped error from buildDSN states the exact reason.","triggerScenarios":"Starting the persistence layer with sqlite driver when cfg.ConnectAttributes contains malformed URI parameters (e.g. 'x=y=z' or unparseable key=value pairs) or the config otherwise prevents DSN construction.","commonSituations":"Misconfigured sqlite ConnectAttributes in the Temporal config YAML; typos like missing '=' in connection attributes; using sqlite in environments where config was copied from mysql/postgres setups.","solutions":["Fix cfg.ConnectAttributes entries to be valid key=value pairs.","Confirm the database name/path in the SQL config is set and writable for the sqlite file.","Compare your config against a known-good sqlite example in config/.","Check the inner buildDSN error for the specific parse failure."],"exampleFix":"// before\nconnectAttributes: {\"cache\": \"shared\", \"mode\": \"ro\" \"bad\"}\n// after\nconnectAttributes: {\"cache\": \"shared\", \"mode\": \"ro\"}","handlingStrategy":"validation","validationCode":"// Go: pre-validate sqlite connect attributes\nfor _, attr := range cfg.ConnectAttributes {\n    if len(strings.Split(attr, \"=\")) < 2 {\n        return fmt.Errorf(\"invalid sqlite connect attribute %q: expected key=value\", attr)\n    }\n}","typeGuard":null,"tryCatchPattern":"// Go\nif err != nil && strings.Contains(err.Error(), \"error building DSN\") {\n    return fmt.Errorf(\"check sqlite config (ConnectAttributes, database path): %w\", err)\n}","preventionTips":["Keep ConnectAttributes as strict key=value pairs","Verify the sqlite file path exists and is writable","Lint your config YAML against a known-good sqlite example","Don't reuse mysql/postgres connect attributes in sqlite configs"],"tags":["sqlite","config","dsn","connection"],"backgroundTag":"invalid-dsn-config","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}