apache/beam · error

err

Error message

err

What it means

The GCS artifact proxy's parseObject helper parses a GCS blob reference ('bucket/object') via gcsx.ParseObject and panics directly on any parse error, surfacing the underlying error object as the panic value (hence the reported message 'err').

Solutions

  1. Validate the artifact's GCS blob string is a well-formed 'bucket/object' (or gs:// URL) before calling GetArtifact
  2. Read the panic value's underlying error message to see exactly how the path failed to parse
  3. Change parseObject to return the error instead of panicking if you control the caller path
  4. Check how artifacts were staged — the staging service usually constructs these paths

Example fix

// before
func parseObject(blob string) (string, string) {
	bucket, object, err := gcsx.ParseObject(blob)
	if err != nil {
		panic(err)
	}
// after
func parseObject(blob string) (string, string, error) {
	bucket, object, err := gcsx.ParseObject(blob)
	if err != nil {
		return "", "", fmt.Errorf("invalid GCS artifact path %q: %w", blob, err)
	}
Defensive patterns

Strategy: validation

Validate before calling

if blob == "" || !strings.Contains(blob, "/") {
	return errors.New("invalid GCS artifact path: expected bucket/object")
}

Try / catch

func safeParseObject(blob string) (bucket, object string) {
	defer func() {
		if r := recover(); r != nil {
			bucket, object = "", ""
		}
	}()
	return parseObject(blob)
}

Prevention

When it happens

Trigger: Calling GetArtifact with an artifact whose GCS reference string is malformed — missing the bucket or object portion, or otherwise not matching gcsx.ParseObject's expected 'gs://bucket/object' shape.

Common situations: Staging artifacts with hand-constructed GCS paths; environment/staging configuration pointing at a non-GCS or truncated artifact location.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/artifact/gcsproxy/retrieval.go:152

		}
		if !fresh {
			return errors.Errorf("multiple locations for %v:%v", l.Name, l.Uri)
		}
		keys[l.Name] = false
	}

	for key, fresh := range keys {
		if fresh {
			return errors.Errorf("no location for %v", key)
		}
	}
	return nil
}

func parseObject(blob string) (string, string) {
	bucket, object, err := gcsx.ParseObject(blob)
	if err != nil {
		panic(err)
	}
	return bucket, object
}

View on GitHub (pinned to 12126d8942)