{"record":{"id":"907ee6c65eb5699d","repo":"crowdsecurity/crowdsec","slug":"while-updating-allowlist-meta-s-s","errorCode":null,"errorMessage":"while updating allowlist meta %s: %s","messagePattern":"while updating allowlist meta (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiserver/apic.go","lineNumber":783,"sourceCode":"\n\tif list == nil {\n\t\tlist, err = a.dbClient.CreateAllowList(ctx, *link.Name, description, *link.ID, true)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"while creating allowlist %s: %s\", *link.Name, err)\n\t\t}\n\t}\n\n\tadded, err := a.dbClient.ReplaceAllowlist(ctx, list, items, true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while replacing allowlist %s: %s\", *link.Name, err)\n\t}\n\n\tlog.Infof(\"added %d values to allowlist %s\", added, list.Name)\n\n\tif list.Name != *link.Name || list.Description != description {\n\t\terr = a.dbClient.UpdateAllowlistMeta(ctx, *link.ID, *link.Name, description)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"while updating allowlist meta %s: %s\", *link.Name, err)\n\t\t}\n\t}\n\n\tlog.Infof(\"Allowlist %s updated\", *link.Name)\n\n\treturn nil\n}\n\nfunc (a *apic) UpdateAllowlists(ctx context.Context, allowlistsLinks []*modelscapi.AllowlistLink, forcePull bool) error {\n\tif len(allowlistsLinks) == 0 {\n\t\treturn nil\n\t}\n\n\tclient, err := apiclient.NewDefaultClient(a.apiClient.BaseURL, \"\", \"\", nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while creating default client: %w\", err)\n\t}\n","sourceCodeStart":765,"sourceCodeEnd":801,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiserver/apic.go#L765-L801","documentation":"If the allowlist's name or description changed since it was stored, updateOneAllowlist calls UpdateAllowlistMeta to sync the metadata locally. This error wraps a failure of that metadata UPDATE, meaning content was replaced but the name/description update in the DB failed.","triggerScenarios":"UpdateAllowlistMeta(link.ID, newName, newDescription) fails: DB write error, the row was deleted between the lookup and the update, a name uniqueness conflict with another allowlist, or connection loss.","commonSituations":"Renaming an allowlist on the console while the local DB has a conflicting name; SQLite lock or read-only DB during the periodic pull; record deleted concurrently by cscli allowlist delete while crowdsec was syncing.","solutions":["Inspect the wrapped %s message for the exact DB failure","Check cscli allowlists list for duplicate/conflicting names and resolve them","Ensure no concurrent cscli deletion/edit of the allowlist during sync","Check DB writability (disk space, sqlite locks) and retry the sync","Restart crowdsec to reset DB connections, then wait for the next pull"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the new name doesn't collide before the meta update\nfor _, al := range existingAllowlists() {\n    if al.Name == newName && al.ID != *link.ID {\n        log.Warnf(\"allowlist name %s conflicts with another allowlist\", newName)\n        return\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := a.updateOneAllowlist(ctx, client, link); err != nil {\n    if strings.Contains(err.Error(), \"while updating allowlist meta\") {\n        log.Errorf(\"allowlist %s content synced but metadata update failed: %s\", *link.Name, err)\n    } else {\n        log.Errorf(\"updating allowlists from CAPI: %s\", err)\n    }\n}","preventionTips":["Don't rename or delete console allowlists via cscli at the same time a sync is running","Keep allowlist names unique across console and local definitions","Ensure the DB stays writable during the sync window","Re-run the sync after resolving any name conflict so metadata converges"],"tags":["database","allowlist","metadata","update"],"backgroundTag":"database-write-failed","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}