{"record":{"id":"c80ba619305bef93","repo":"owasp-amass/amass","slug":"zero-decoded-assets","errorCode":null,"errorMessage":"zero decoded assets","messagePattern":"zero decoded assets","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/api/client/asset_decode.go","lineNumber":245,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\tfor _, a := range scope.Data {\n\t\t\tresults = append(results, &a)\n\t\t}\n\tcase oam.URL:\n\t\tvar scope struct {\n\t\t\tData []oamurl.URL `json:\"data\"`\n\t\t}\n\t\tif err := json.NewDecoder(data).Decode(&scope); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, a := range scope.Data {\n\t\t\tresults = append(results, &a)\n\t\t}\n\t}\n\n\tif len(results) == 0 {\n\t\treturn nil, errors.New(\"zero decoded assets\")\n\t}\n\treturn results, nil\n}\n","sourceCodeStart":227,"sourceCodeEnd":249,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/engine/api/client/asset_decode.go#L227-L249","documentation":"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.","triggerScenarios":"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.","commonSituations":"Querying a newly created scope with no ingested assets, over-restrictive scope filters, or stale scope identifiers after data cleanup.","solutions":["Verify assets exist for the scope before decoding (list scopes/assets first).","Broaden the scope filter so it matches ingested data.","Ingest assets for the scope before requesting decoded output.","Handle the error client-side by treating it as 'no data yet' if that is expected."],"exampleFix":"// before\nresults, err := client.DecodeAssetsForScope(ctx, scopeID)\n// after\nassets, err := client.ListAssets(ctx, scopeID)\nif len(assets) == 0 { return nil } // skip decode when scope is empty\nresults, err := client.DecodeAssetsForScope(ctx, scopeID)","handlingStrategy":"try-catch","validationCode":"scope, err := client.GetScope(ctx, scopeID)\nif err != nil { return err }\nif len(scope.Data) == 0 { return fmt.Errorf(\"scope %s has no assets to decode\", scopeID) }","typeGuard":null,"tryCatchPattern":"results, err := endpoint.DecodeAssetsForScope(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"zero decoded assets\") {\n        // treat as empty result: log and return an empty slice\n        return []*Asset{}, nil\n    }\n    return err\n}","preventionTips":["Check scope asset counts before decoding.","Ingest data for scopes before requesting decoded assets.","Differentiate 'empty' from 'failure' in API design.","Monitor scopes with zero assets via metrics."],"tags":["api","empty-result","assets"],"backgroundTag":"empty-result-set","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}