hcengineering/platform · error
workspace is missed
Error message
workspace is missed
What it means
NewStorageByURL creates a Storage implementation based on the URL scheme (e.g. datalake://). It requires a non-empty workspace name to scope all object operations, and throws this error before any storage backend is contacted when the workspace argument is an empty string.
Source
Thrown at foundations/stream/internal/pkg/storage/storage.go:71
// MultipartPart represents uploaded multipart part
type MultipartPart struct {
PartNumber int `json:"partNumber"`
ETag string `json:"etag"`
}
// MultipartStorage represents multipart-based storage
type MultipartStorage interface {
MultipartUploadStart(ctx context.Context, objectName, contentType string) (string, error)
MultipartUploadPart(ctx context.Context, objectName, uploadID string, partNumber int, data []byte) (*MultipartPart, error)
MultipartUploadComplete(ctx context.Context, objectName, uploadID string, parts []MultipartPart) error
MultipartUploadCancel(ctx context.Context, objectName, uploadID string) error
}
// NewStorageByURL creates a new storage based on the type from the url scheme, for example "datalake://my-datalake-endpoint"
func NewStorageByURL(ctx context.Context, u *url.URL, storageType, token, workspace string) (Storage, error) {
if workspace == "" {
return nil, errors.New("workspace is missed")
}
switch storageType {
case "datalake":
if token == "" {
return nil, errors.New("token is missed")
}
return NewDatalakeStorage(ctx, u.String(), workspace, token), nil
case "s3":
return NewS3(ctx, u.String(), workspace), nil
default:
return nil, errors.New("unknown scheme")
}
}
func getContentType(objectKey string) string {
if strings.HasSuffix(objectKey, ".ts") {
return "video/mp2t"
}View on GitHub (pinned to 63e28dc964)
Solutions
- Pass a non-empty workspace string to NewStorageByURL
- Verify the config/env variable that supplies the workspace is set before calling
- Log or validate the workspace value at the call sites (stg, processTask, Transcode) before constructing storage
Example fix
// before
storage, err := NewStorageByURL(ctx, u, "datalake", token, cfg.Workspace) // cfg.Workspace == ""
// after
if cfg.Workspace == "" {
return fmt.Errorf("WORKSPACE must be configured")
}
storage, err := NewStorageByURL(ctx, u, "datalake", token, cfg.Workspace) Defensive patterns
Strategy: validation
Validate before calling
if workspace == "" {
return nil, fmt.Errorf("storage: workspace must be provided")
}
storage, err := NewStorageByURL(ctx, u, storageType, token, workspace) Try / catch
storage, err := NewStorageByURL(ctx, u, storageType, token, workspace)
if err != nil {
return fmt.Errorf("init storage: %w", err)
} Prevention
- Validate config (workspace, token) at startup before constructing storage
- Fail fast with clear messages when env vars are empty
- Add a unit test asserting NewStorageByURL rejects empty workspace
When it happens
Trigger: Calling NewStorageByURL with workspace="" — typically because the workspace value came from an unset config field, an empty environment variable, or a request context where the workspace was never resolved.
Common situations: Deployments with a missing WORKSPACE env var; callers that extract workspace from a token or URL but pass the empty default; refactoring where a caller forgot the newly added workspace parameter.
Related errors
- Endpoint value is not specified
- No screen access granted
- Accounts url not specified
- Ticks per second has an invalid value: must be >= 1 && <= 10
- Interval must be a finite number >= 1 (seconds)
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/3cd2303c4127007d.
Report an issue: GitHub.