goharbor/harbor · error

empty json data to parse

Error message

empty json data to parse

What it means

Error "empty json data to parse" thrown in goharbor/harbor.

Source

Thrown at src/pkg/scan/rest/v1/models.go:214

	Artifact *Artifact `json:"artifact"`
	// RequestType
	RequestType []*ScanType `json:"enabled_capabilities"`
}

// ScanType represent the type of the scan request
type ScanType struct {
	// Type sets the type of the scan, it could be sbom or vulnerability, default is vulnerability
	Type string `json:"type"`
	// ProducesMimeTypes defines scanreport should be
	ProducesMimeTypes []string `json:"produces_mime_types"`
	// Parameters extra parameters
	Parameters map[string]any `json:"parameters"`
}

// FromJSON parses ScanRequest from json data
func (s *ScanRequest) FromJSON(jsonData string) error {
	if len(jsonData) == 0 {
		return errors.New("empty json data to parse")
	}

	return json.Unmarshal([]byte(jsonData), s)
}

// ToJSON marshals ScanRequest to JSON data
func (s *ScanRequest) ToJSON() (string, error) {
	data, err := json.Marshal(s)
	if err != nil {
		return "", err
	}

	return string(data), nil
}

// Validate ScanRequest
func (s *ScanRequest) Validate() error {
	if s.Registry == nil ||

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/scan/rest/v1/models.go:214 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/e9dacd6c4f13d084. Report an issue: GitHub.