{"record":{"id":"8e4a301b2e9d81df","repo":"apache/pulsar","slug":"start-function-failed-please-check","errorCode":null,"errorMessage":"start function failed, please check.","messagePattern":"start function failed, please check\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pulsar-function-go/pf/function.go","lineNumber":174,"sourceCode":"//\tfunc ()\n//\tfunc () error\n//\tfunc (input) error\n//\tfunc () (output, error)\n//\tfunc (input) (output, error)\n//\tfunc (context.Context) error\n//\tfunc (context.Context, input) error\n//\tfunc (context.Context) (output, error)\n//\tfunc (context.Context, input) (output, error)\n//\n// Where \"input\" and \"output\" are types compatible with the \"encoding/json\" standard library.\n// See https://golang.org/pkg/encoding/json/#Unmarshal for how deserialization behaves\nfunc Start(funcName interface{}) {\n\tfunction := newFunction(funcName)\n\tgoInstance := newGoInstance()\n\terr := goInstance.startFunction(function)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\tpanic(\"start function failed, please check.\")\n\t}\n}\n\n// GetUserConfMap provides a means to access the pulsar function's user config\n// map before initializing the pulsar function\nfunc GetUserConfMap() map[string]interface{} {\n\treturn NewFuncContext().userConfigs\n}\n\n// GetUserConfValue provides access to a user configuration value before\n// initializing the pulsar function\nfunc GetUserConfValue(key string) interface{} {\n\treturn NewFuncContext().userConfigs[key]\n}\n","sourceCodeStart":156,"sourceCodeEnd":189,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-function-go/pf/function.go#L156-L189","documentation":"pf.Start builds the function and a Go instance, then starts it. Any error returned by goInstance.startFunction is logged with log.Fatal (which exits) followed by a panic with this message; it indicates the function instance failed to boot (bad handler, config, or broker connectivity handled upstream).","triggerScenarios":"startFunction returns an error — e.g. the wrapped function was built by errorHandler (nil/invalid handler), or instance setup (client/producer) failed.","commonSituations":"Misconfigured function passed to Start; invalid handler signature; broker unreachable during instance startup; container entrypoint wiring errors.","solutions":["Read the log.Fatal output immediately above the panic — it contains the underlying error.","Fix the root cause (nil/invalid handler, client/producer setup error).","Test Start() locally with a minimal valid handler before deploying."],"exampleFix":"// before\npf.Start(nil) // panics: start function failed, please check.\n// after\npf.Start(func(ctx context.Context, in []byte) ([]byte, error) { return in, nil })","handlingStrategy":"try-catch","validationCode":"// recover around startup in a wrapper main\nfunc safeStart(f interface{}) {\n    defer func() {\n        if r := recover(); r != nil {\n            log.Printf(\"function start failed: %v\", r)\n            os.Exit(1)\n        }\n    }()\n    pf.Start(f)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        log.Printf(\"start function failed: %v\", r)\n        os.Exit(1)\n    }\n}()\npf.Start(myFunc)","preventionTips":["Always read the log.Fatal line preceding the panic — it names the root cause.","Validate the handler and instance config before calling Start.","Smoke-test function startup locally before deploying."],"tags":["go","startup","panic","function-lifecycle"],"backgroundTag":"function-startup-failed","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}