{"record":{"id":"ad06e1ddd3ed3649","repo":"vxcontrol/pentagi","slug":"barrier-done-handler-is-required","errorCode":null,"errorMessage":"barrier (done) handler is required","messagePattern":"barrier \\(done\\) handler is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/tools.go","lineNumber":1002,"sourceCode":"\t\tuserID:      fte.userID,\n\t\tflowID:      fte.flowID,\n\t\tmlp:         fte.mlp,\n\t\ttclp:        fte.tclp,\n\t\tvslp:        fte.vslp,\n\t\tdb:          fte.db,\n\t\tstore:       fte.store,\n\t\tdefinitions: definitions,\n\t\thandlers:    handlers,\n\t\tbarriers:    map[string]struct{}{},\n\t\tsummarizer:  cfg.Summarizer,\n\t}\n\n\treturn ce, nil\n}\n\nfunc (fte *flowToolsExecutor) GetPrimaryExecutor(cfg PrimaryExecutorConfig) (ContextToolsExecutor, error) {\n\tif cfg.Barrier == nil {\n\t\treturn nil, fmt.Errorf(\"barrier (done) handler is required\")\n\t}\n\n\tif cfg.Adviser == nil {\n\t\treturn nil, fmt.Errorf(\"adviser handler is required\")\n\t}\n\n\tif cfg.Coder == nil {\n\t\treturn nil, fmt.Errorf(\"coder handler is required\")\n\t}\n\n\tif cfg.Installer == nil {\n\t\treturn nil, fmt.Errorf(\"installer handler is required\")\n\t}\n\n\tif cfg.Memorist == nil {\n\t\treturn nil, fmt.Errorf(\"memorist handler is required\")\n\t}\n","sourceCodeStart":984,"sourceCodeEnd":1020,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/tools.go#L984-L1020","documentation":"GetPrimaryExecutor requires the Barrier handler to be non-nil; it backs the 'done' barrier tool that lets the primary agent signal task completion. Construction fails fast with this error when cfg.Barrier is nil.","triggerScenarios":"Calling GetPrimaryExecutor with cfg.Barrier == nil — the done/barrier handler was omitted from PrimaryExecutorConfig.","commonSituations":"Building the primary executor config without the barrier handler; confusing PrimaryExecutorConfig with CustomExecutorConfig (which uses barrier names instead of handlers); refactoring dropped the field.","solutions":["Assign a non-nil Barrier handler in PrimaryExecutorConfig.","Ensure the barrier handler construction (done handler) ran before calling GetPrimaryExecutor.","Validate the config struct fields before the call."],"exampleFix":"// before\nexecutor, err := fte.GetPrimaryExecutor(PrimaryExecutorConfig{\n  Adviser: adviser,\n}) // Barrier nil\n// after\nexecutor, err := fte.GetPrimaryExecutor(PrimaryExecutorConfig{\n  Barrier: barrier,\n  Adviser: adviser,\n})","handlingStrategy":"validation","validationCode":"if cfg.Barrier == nil {\n    return errors.New(\"barrier (done) handler missing from PrimaryExecutorConfig\")\n}","typeGuard":"func hasBarrier(cfg tools.PrimaryExecutorConfig) bool {\n    return cfg.Barrier != nil\n}","tryCatchPattern":"executor, err := fte.GetPrimaryExecutor(cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"barrier (done) handler is required\") {\n        return fmt.Errorf(\"wiring bug: done handler not built: %w\", err)\n    }\n    return err\n}","preventionTips":["Always wire the done/barrier handler when building the primary executor.","Do not confuse PrimaryExecutorConfig (handler fields) with CustomExecutorConfig (barrier name strings).","Assert all PrimaryExecutorConfig fields non-nil in a setup test."],"tags":["configuration","nil-handler","primary-executor"],"backgroundTag":"required-handler-missing","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}