owasp-amass/amass · error

zero decoded assets

Error message

zero decoded assets

What it means

DecodeAssetsForScopeEndpoint decodes assets for a given scope and returns the decoded slice; when the scope contains no data (and any other decode path produced nothing), it returns this error instead of an empty result, signaling to API callers that no assets matched the requested scope.

Source

Thrown at engine/api/client/asset_decode.go:245

			return nil, err
		}
		for _, a := range scope.Data {
			results = append(results, &a)
		}
	case oam.URL:
		var scope struct {
			Data []oamurl.URL `json:"data"`
		}
		if err := json.NewDecoder(data).Decode(&scope); err != nil {
			return nil, err
		}
		for _, a := range scope.Data {
			results = append(results, &a)
		}
	}

	if len(results) == 0 {
		return nil, errors.New("zero decoded assets")
	}
	return results, nil
}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Verify assets exist for the scope before decoding (list scopes/assets first).
  2. Broaden the scope filter so it matches ingested data.
  3. Ingest assets for the scope before requesting decoded output.
  4. Handle the error client-side by treating it as 'no data yet' if that is expected.

Example fix

// before
results, err := client.DecodeAssetsForScope(ctx, scopeID)
// after
assets, err := client.ListAssets(ctx, scopeID)
if len(assets) == 0 { return nil } // skip decode when scope is empty
results, err := client.DecodeAssetsForScope(ctx, scopeID)
Defensive patterns

Strategy: try-catch

Validate before calling

scope, err := client.GetScope(ctx, scopeID)
if err != nil { return err }
if len(scope.Data) == 0 { return fmt.Errorf("scope %s has no assets to decode", scopeID) }

Try / catch

results, err := endpoint.DecodeAssetsForScope(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "zero decoded assets") {
        // treat as empty result: log and return an empty slice
        return []*Asset{}, nil
    }
    return err
}

Prevention

When it happens

Trigger: Calling the decode-assets endpoint/function with a scope whose Data slice is empty or nil — e.g. a scope filter that matches nothing, or querying before any assets were ingested for that scope.

Common situations: Querying a newly created scope with no ingested assets, over-restrictive scope filters, or stale scope identifiers after data cleanup.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/c80ba619305bef93. Report an issue: GitHub.