flipped-aurora/gin-vue-admin · critical
sys_ignore_apis表数据初始化失败!
Error message
sys_ignore_apis表数据初始化失败!
What it means
The initApiIgnore initializer seeds sys_ignore_apis (APIs excluded from Casbin registration, e.g. /init/initdb itself). Its bulk Create failed and the error was wrapped with this message. Failure here aborts the initializer chain, so later initializers never run.
Source
Thrown at server/source/system/api_ignore.go:62
}
entities := []sysModel.SysIgnoreApi{
{Method: "GET", Path: "/swagger/*any"},
{Method: "GET", Path: "/api/freshCasbin"},
{Method: "GET", Path: "/uploads/file/*filepath"},
{Method: "GET", Path: "/health"},
{Method: "HEAD", Path: "/uploads/file/*filepath"},
{Method: "POST", Path: "/autoCode/llmAuto"},
{Method: "POST", Path: "/autoCode/llmAutoSSE"},
{Method: "POST", Path: "/system/reloadSystem"},
{Method: "POST", Path: "/base/login"},
{Method: "POST", Path: "/base/captcha"},
{Method: "POST", Path: "/init/initdb"},
{Method: "POST", Path: "/init/checkdb"},
{Method: "GET", Path: "/info/getInfoDataSource"},
{Method: "GET", Path: "/info/getInfoPublic"},
}
if err := db.Create(&entities).Error; err != nil {
return ctx, errors.Wrap(err, sysModel.SysIgnoreApi{}.TableName()+"表数据初始化失败!")
}
next := context.WithValue(ctx, i.InitializerName(), entities)
return next, nil
}
func (i *initApiIgnore) DataInserted(ctx context.Context) bool {
db, ok := ctx.Value("db").(*gorm.DB)
if !ok {
return false
}
if errors.Is(db.Where("path = ? AND method = ?", "/swagger/*any", "GET").
First(&sysModel.SysIgnoreApi{}).Error, gorm.ErrRecordNotFound) {
return false
}
return true
}
View on GitHub (pinned to 3136500ef3)
Solutions
- Inspect the wrapped driver error for the concrete cause (duplicate entry, unknown column, access denied).
- Drop/truncate sys_ignore_apis (or the whole DB) and re-run InitDB for a clean seed.
- Ensure the table schema is current - rely on AutoMigrate during init instead of hand-edited DDL.
- Grant the init DB user INSERT/CREATE privileges and verify connectivity.
- Re-run /init/initdb.
Defensive patterns
Strategy: try-catch
Validate before calling
// verify connectivity and that sys_ignore_apis has no seed rows yet
count, err := countRows(db, "sys_ignore_apis")
if err == nil && count > 0 { /* already initialized - skip re-init */ } Try / catch
if err := initdb(); err != nil {
if strings.Contains(err.Error(), "sys_ignore_apis") {
log.Printf("ignore-api seed failed, inspect cause: %v", errors.Unwrap(err))
}
return err
} Prevention
- Don't re-run initdb on an already-seeded database
- Rely on AutoMigrate for schema currency
- Confirm DB write privileges before init
- Surface errors.Unwrap in logs for the real driver error
When it happens
Trigger: InitDB reaches the api-ignore step and INSERT INTO sys_ignore_apis fails - duplicate seeded rows on a re-init, stale table schema, lost DB connection, or insufficient INSERT privileges.
Common situations: Re-running initdb against a database that already contains sys_ignore_apis rows; manual schema edits removing new columns; read-only DB account; MySQL max_connections/timeouts during bulk init.
Related errors
- media.FileUploadAndDownload表数据初始化失败!
- sys_apis表数据初始化失败!
- %s表数据初始化失败!
- sys_positions表数据初始化失败!
- sys_dictionaries表数据初始化失败!
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/fdc449b978a3f0d8.
Report an issue: GitHub.