{"record":{"id":"0e741233b13f9015","repo":"sipeed/picoclaw","slug":"ingest-sample-s-w","errorCode":null,"errorMessage":"ingest sample %s: %w","messagePattern":"ingest sample (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/membench/ingest.go","lineNumber":65,"sourceCode":"\t\t}\n\n\t\tturns := GetTurns(sample)\n\n\t\t// Convert turns to seahorse messages\n\t\tmsgs := make([]seahorse.Message, 0, len(turns))\n\t\tfor _, turn := range turns {\n\t\t\tcontent := turn.Speaker + \": \" + turn.Text\n\t\t\tmsgs = append(msgs, seahorse.Message{\n\t\t\t\tRole:       \"user\",\n\t\t\t\tContent:    content,\n\t\t\t\tTokenCount: len(turn.Text) / 4,\n\t\t\t})\n\t\t}\n\n\t\t// Ingest all turns for this sample\n\t\t_, err := engine.Ingest(ctx, sessionKey, msgs)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ingest sample %s: %w\", sample.SampleID, err)\n\t\t}\n\n\t\t// Get the conversation ID for scoped retrieval\n\t\tconv, err := store.GetConversationBySessionKey(ctx, sessionKey)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"get conversation for %s: %w\", sample.SampleID, err)\n\t\t}\n\t\tif conv == nil {\n\t\t\treturn nil, fmt.Errorf(\"conversation not found for %s after ingest\", sample.SampleID)\n\t\t}\n\t\tconvMap[sample.SampleID] = conv.ConversationID\n\t\tlog.Printf(\"Ingested sample %s: %d turns, convID=%d\", sample.SampleID, len(turns), conv.ConversationID)\n\t}\n\n\tlog.Printf(\"Seahorse ingestion complete: %d samples, %d conversations\", len(samples), len(convMap))\n\treturn &SeahorseIngestResult{\n\t\tEngine:  engine,\n\t\tConvMap: convMap,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/membench/ingest.go#L47-L83","documentation":"engine.Ingest failed for one LOCOMO sample during bulk ingestion (cmd/membench/ingest.go). All turns of a conversation are submitted under sessionKey \"locomo-<sampleID>\"; any storage/embedding failure inside the engine bubbles up wrapped with the sample ID, halting the whole ingestion run at that sample.","triggerScenarios":"Sqlite write error (disk full, DB locked by a concurrent reader); context cancelled mid-ingest; an individual message failing engine-internal validation; embedding backend error if the engine computes embeddings inline.","commonSituations":"Long ingestion runs interrupted by Ctrl-C or context timeout; DB on a volume that fills with conversation data; second concurrent membench run against the same dbPath.","solutions":["Inspect the wrapped error text — it carries the engine's real cause (locked, full, cancelled)","Free space or resolve the DB lock, then simply rerun: the existing-conversation check makes ingestion resume from the first missing sample","Increase or disable the context deadline for large corpora","Run only one ingestion against a given dbPath at a time"],"exampleFix":"// before\nif _, err := engine.Ingest(ctx, sessionKey, msgs); err != nil {\n    return nil, fmt.Errorf(\"ingest sample %s: %w\", sample.SampleID, err)\n}\n\n// after\nif _, err := engine.Ingest(ctx, sessionKey, msgs); err != nil {\n    if ctx.Err() != nil {\n        return nil, fmt.Errorf(\"ingest cancelled at sample %s: %w\", sample.SampleID, ctx.Err())\n    }\n    log.Printf(\"sample %s failed (%v); skipping\", sample.SampleID, err)\n    continue\n}","handlingStrategy":"try-catch","validationCode":"if existing, _ := store.GetConversationBySessionKey(ctx, sessionKey); existing != nil {\n    convMap[sample.SampleID] = existing.ConversationID // already ingested; skip\n    continue\n}","typeGuard":null,"tryCatchPattern":"if _, err := engine.Ingest(ctx, sessionKey, msgs); err != nil {\n    if ctx.Err() != nil {\n        return nil, fmt.Errorf(\"cancelled at %s: %w\", sample.SampleID, ctx.Err())\n    }\n    log.Printf(\"skip sample %s: %v\", sample.SampleID, err)\n    continue // or abort, depending on desired strictness\n}","preventionTips":["Exploit the idempotent existing-conversation check: reruns resume, don't duplicate","Set a generous context deadline for full-corpus ingestion","Keep a single writer on the DB during ingestion","Log sampleID on failure so reruns can target the gap"],"tags":["go","database","ingestion","benchmark"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}