crowdsecurity/crowdsec · error

unable to insert row

Error message

unable to insert row

What it means

Sentinel database.InsertFail: wrapping error indicating the underlying ent/SQL INSERT failed — used for machine creation and lock insertion. The wrapped error carries the driver detail (constraint violation, sqlite BUSY, etc.).

Source

Thrown at pkg/database/errors.go:9

package database

import "errors"

var (
	UserExists        = errors.New("user already exist")
	UserNotExists     = errors.New("user doesn't exist")
	HashError         = errors.New("unable to hash")
	InsertFail        = errors.New("unable to insert row")
	QueryFail         = errors.New("unable to query")
	UpdateFail        = errors.New("unable to update")
	DeleteFail        = errors.New("unable to delete")
	ItemNotFound      = errors.New("object not found")
	ParseTimeFail     = errors.New("unable to parse time")
	ParseDurationFail = errors.New("unable to parse duration")
	MarshalFail       = errors.New("unable to serialize")
	BulkError         = errors.New("unable to insert bulk")
	ParseType         = errors.New("unable to parse type")
	InvalidIPOrRange  = errors.New("invalid ip address / range")
	InvalidFilter     = errors.New("invalid filter")
)

View on GitHub (pinned to 909b515798)

Solutions

  1. Inspect the wrapped error for the root cause (unique constraint, DB busy, disk full)
  2. For sqlite BUSY, the lock path already retries; reduce concurrent writers or tune max_open_conns
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/database/errors.go:9 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/bad445af83aac1c3. Report an issue: GitHub.