apache/beam · error · missingFlagError

no job service endpoint specified. Use --endpoint=

Error message

no job service endpoint specified. Use --endpoint=<endpoint>

What it means

jobopts.GetEndpoint reads the --endpoint flag for the Beam job service and returns this error when the flag value is empty. Runners like Dataflow set a reasonable default, but direct/other submission paths require an explicit endpoint. The error is a typed missingFlagError so callers can distinguish it.

Solutions

  1. Pass --endpoint=<host:port> when launching the pipeline (e.g. --endpoint=localhost:8099)
  2. Set the flag programmatically before calling GetEndpoint, e.g. flag.Set("endpoint", "localhost:8099") or jobopts.Endpoint = &val
  3. Check for missingFlagError in the caller and print usage guidance

Example fix

// before
endpoint, err := jobopts.GetEndpoint() // empty --endpoint
// after
flag.Parse()
if *jobopts.Endpoint == "" {
    flag.Set("endpoint", "localhost:8099")
}
endpoint, err := jobopts.GetEndpoint()
Defensive patterns

Strategy: try-catch

Validate before calling

if *jobopts.Endpoint == "" {
    return errors.New("--endpoint is required")
}

Try / catch

ep, err := jobopts.GetEndpoint()
if err != nil {
    var mf jobopts.MissingFlagError
    if errors.As(err, &mf) {
        log.Fatal("provide --endpoint=<host:port>")
    }
    return err
}

Prevention

When it happens

Trigger: Calling jobopts.GetEndpoint() (directly or via job submission code paths like Execute) without registering or setting the --endpoint flag, or the user not passing --endpoint=<host:port> on the command line.

Common situations: Running a Go Beam pipeline against a Flink/Spark/SMEE job server without --endpoint; forgetting to call jobopts flags registration in a custom main; CI invoking the binary without the flag.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/ab49c6d268aa210c. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/options/jobopts/options.go:116

	// Parallelisn flag to set the degree of parallelism. If not set, the configured Flink default is used, or 1 if none can be found.
	Parallelism = flag.Int("parallelism", -1, "The degree of parallelism to be used when distributing operations onto Flink workers.")

	// ResourceHints flag takes whole pipeline hints for resources.
	ResourceHints stringSlice

	// ElementProcessingTimeout flag to set the timeout for processing an element in a PTransform operation. If set to -1, there is no timeout.
	ElementProcessingTimeout = flag.Duration("element_processing_timeout", -1,
		"The time limit (in minutes) for any PTransform to finish processing a single element. If exceeded, "+
			"the SDK worker process self-terminates and processing may be restarted by a runner. There is no time limit if the value is set to -1.")
)

type missingFlagError error

// GetEndpoint returns the endpoint, if non empty and exits otherwise. Runners
// such as Dataflow set a reasonable default. Convenience function.
func GetEndpoint() (string, error) {
	if *Endpoint == "" {
		return "", missingFlagError(errors.New("no job service endpoint specified. Use --endpoint=<endpoint>"))
	}
	return *Endpoint, nil
}

var unique int32

// GetJobName returns the specified job name or, if not present, a fresh
// autogenerated name. Convenience function.
func GetJobName() string {
	if *JobName == "" {
		id := atomic.AddInt32(&unique, 1)
		return fmt.Sprintf("go-job-%v-%v", id, time.Now().UnixNano())
	}
	return *JobName
}

// GetEnvironmentUrn returns the specified EnvironmentUrn used to run the SDK Harness,
// if not present, returns the docker environment urn "beam:env:docker:v1".

View on GitHub (pinned to 12126d8942)