{"record":{"id":"3755cec203b09e08","repo":"apache/beam","slug":"endpoint-not-defined","errorCode":null,"errorMessage":"endpoint not defined","messagePattern":"endpoint not defined","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/cmd/beamctl/cmd/root.go","lineNumber":50,"sourceCode":"\t\tUse:   \"beamctl\",\n\t\tShort: \"Apache Beam command line client\",\n\t}\n\n\tid       string\n\tendpoint string\n)\n\nfunc init() {\n\tRootCmd.AddCommand(artifactCmd, provisionCmd)\n\tRootCmd.PersistentFlags().StringVarP(&endpoint, \"endpoint\", \"e\", \"\", \"Server endpoint, such as localhost:123\")\n\tRootCmd.PersistentFlags().StringVarP(&id, \"id\", \"i\", \"\", \"Client ID\")\n}\n\n// dial connects via gRPC to the given endpoint and returns the connection\n// and the context to use.\nfunc dial() (context.Context, *grpc.ClientConn, error) {\n\tif endpoint == \"\" {\n\t\treturn nil, nil, errors.New(\"endpoint not defined\")\n\t}\n\n\tctx := grpcx.WriteWorkerID(context.Background(), id)\n\tcc, err := grpcx.Dial(ctx, endpoint, time.Minute)\n\treturn ctx, cc, err\n}\n","sourceCodeStart":32,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/cmd/beamctl/cmd/root.go#L32-L57","documentation":"beamctl's dial() refuses to connect when the --endpoint flag/value is empty, returning errors.New(\"endpoint not defined\") before any gRPC dial is attempted. All subcommands (stage, list, info) route through dial, so none can run without an endpoint.","triggerScenarios":"Running `beamctl stage/list/info` without the --endpoint flag, or with the endpoint variable left unset (empty string).","commonSituations":"Forgetting the flag in scripts/CI, or expecting a default localhost endpoint that beamctl does not provide; also occurs when the flag is defined with an empty default and the env var is missing.","solutions":["Pass the runner endpoint explicitly: beamctl list --endpoint=<host:port>.","Check the flag spelling (--endpoint) so pflag actually binds the value.","Verify the Beam runner/job-service address is reachable and correctly formatted (host:port)."],"exampleFix":"// before\nbeamctl list\n// after\nbeamctl list --endpoint=localhost:8073","handlingStrategy":"validation","validationCode":"if endpoint == \"\" {\n\treturn fmt.Errorf(\"--endpoint is required, e.g. --endpoint=localhost:8073\")\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.RunE(cmdCtx, args); err != nil && strings.Contains(err.Error(), \"endpoint not defined\") {\n\treturn fmt.Errorf(\"usage: beamctl %s --endpoint=<host:port>\", cmdName)\n}","preventionTips":["Always pass --endpoint in scripts/CI invocations of beamctl.","Mark the flag required (cmd.MarkFlagRequired(\"endpoint\")) so pflag errors early.","Store the endpoint in a wrapper script or env-sourced default."],"tags":["go","cli","grpc","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}