{"record":{"id":"8d91ca5721d1e328","repo":"Tencent/WeKnora","slug":"questions-can-only-be-generated-for-text-chunks","errorCode":null,"errorMessage":"questions can only be generated for text chunks","messagePattern":"questions can only be generated for text chunks","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_process.go","lineNumber":2180,"sourceCode":"\t\t}\n\t}\n\n\treturn questions, nil\n}\n\n// RegenerateChunkQuestions synchronously refreshes Doc2Query-style auxiliary\n// questions for the current chunk revision and atomically replaces their\n// retrieval entries through updateChunkVector.\nfunc (s *knowledgeService) RegenerateChunkQuestions(\n\tctx context.Context, chunkID string,\n) ([]types.GeneratedQuestion, error) {\n\ttenantID := types.MustTenantIDFromContext(ctx)\n\tchunk, err := s.chunkRepo.GetChunkByID(ctx, tenantID, chunkID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif chunk.ChunkType != types.ChunkTypeText {\n\t\treturn nil, fmt.Errorf(\"questions can only be generated for text chunks\")\n\t}\n\tgenerationRevision := chunk.ContentRevision\n\tknowledge, err := s.repo.GetKnowledgeByID(ctx, tenantID, chunk.KnowledgeID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tkb, err := s.kbService.GetKnowledgeBaseByID(ctx, chunk.KnowledgeBaseID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif kb.SummaryModelID == \"\" {\n\t\treturn nil, fmt.Errorf(\"summary model is required for question generation\")\n\t}\n\tchatModel, err := s.modelService.GetChatModel(ctx, kb.SummaryModelID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresolveNeighbor := func(id string) string {","sourceCodeStart":2162,"sourceCodeEnd":2198,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_process.go#L2162-L2198","documentation":"Type guard in RegenerateChunkQuestions: the requested chunk's ChunkType is not ChunkTypeText (e.g. a summary or table chunk). Question generation is only defined for text chunks; the input chunkID points at the wrong kind of chunk.","triggerScenarios":"Thrown at internal/application/service/knowledge_process.go:2180 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call the endpoint with a text chunk's ID","List chunk types first to select a ChunkTypeText chunk","Guard client-side against passing summary/table chunk IDs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}