sipeed/picoclaw · error

create crypto database directory: %w

Error message

create crypto database directory: %w

What it means

Error "create crypto database directory: %w" thrown in sipeed/picoclaw.

Source

Thrown at pkg/channels/matrix/matrix.go:330

	}

	// Close crypto helper if initialized
	if c.cryptoHelper != nil {
		c.cryptoHelper.Close()
		c.cryptoHelper = nil
		c.client.Crypto = nil
	}

	logger.InfoC("matrix", "Matrix channel stopped")
	return nil
}

func (c *MatrixChannel) initCrypto(ctx context.Context) error {
	logger.InfoC("matrix", "Initializing crypto helper")

	// Ensure the crypto database directory exists
	if err := os.MkdirAll(c.cryptoDbPath, 0o700); err != nil {
		return fmt.Errorf("create crypto database directory: %w", err)
	}

	// Create database with sqlite driver (modernc.org/sqlite)
	dbPath := filepath.Join(c.cryptoDbPath, dbName)
	connStr := "file:" + dbPath + "?_foreign_keys=on"

	db, err := sql.Open(sqliteDriver, connStr)
	if err != nil {
		return fmt.Errorf("open crypto database: %w", err)
	}
	db.SetMaxOpenConns(1)
	db.SetMaxIdleConns(1)

	// Execute PRAGMA statements
	// This is equivalent to the "sqlite3-fk-wal" dialect used by cryptohelper
	pragmaStmts := []string{
		"PRAGMA foreign_keys = ON",
		"PRAGMA journal_mode = WAL",

View on GitHub (pinned to 49183d7e8d)

When it happens

Trigger: Thrown at pkg/channels/matrix/matrix.go:330 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/133c7631af508395. Report an issue: GitHub.