{"record":{"id":"0fbfc85ed78e2532","repo":"Tencent/WeKnora","slug":"fmt-errorf-format-args-dynamic-message","errorCode":null,"errorMessage":"fmt.Errorf(format, args...) (dynamic message)","messagePattern":"fmt\\.Errorf\\(format, args\\.\\.\\.\\) \\(dynamic message\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/knowledge_process.go","lineNumber":3846,"sourceCode":"\treturn reader\n}\n\n// failKnowledge marks knowledge as failed (only on last retry) and returns an error.\nfunc (s *knowledgeService) failKnowledge(\n\tctx context.Context,\n\tknowledge *types.Knowledge,\n\tisLastRetry bool,\n\tformat string,\n\targs ...interface{},\n) (*types.ReadResult, error) {\n\terrMsg := fmt.Sprintf(format, args...)\n\tif isLastRetry {\n\t\tknowledge.ParseStatus = \"failed\"\n\t\tknowledge.ErrorMessage = errMsg\n\t\tknowledge.UpdatedAt = time.Now()\n\t\ts.repo.UpdateKnowledge(ctx, knowledge)\n\t}\n\treturn nil, fmt.Errorf(format, args...)\n}\n\n// enqueueImageMultimodalTasks enqueues asynq tasks for multimodal image processing.\nfunc (s *knowledgeService) enqueueImageMultimodalTasks(\n\tctx context.Context,\n\tknowledge *types.Knowledge,\n\tkb *types.KnowledgeBase,\n\timages []docparser.StoredImage,\n\tchunks []types.ParsedChunk,\n\tmetadata map[string]string,\n) {\n\tif s.task == nil || len(images) == 0 {\n\t\treturn\n\t}\n\n\tattempt := attemptFromCtx(ctx)\n\tredisKey := fmt.Sprintf(\"multimodal:pending:%s\", knowledge.ID)\n\tif s.redisClient != nil {","sourceCodeStart":3828,"sourceCodeEnd":3864,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/knowledge_process.go#L3828-L3864","documentation":"Dynamic sentinel wrapper: failKnowledge is a helper that marks the knowledge ParseStatus='failed' with the formatted message only on the last asynq retry, and always returns the error so intermediate attempts retry. The message text is supplied by each caller at its throw site.","triggerScenarios":"Thrown at internal/application/service/knowledge_process.go:3846 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Locate the failKnowledge call site to identify the actual failure stage","Inspect knowledge.ErrorMessage after terminal failure for the formatted details","Fix the underlying parse/pipeline cause and re-trigger the parse task"],"exampleFix":null,"handlingStrategy":"retry","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"}