{"record":{"id":"2c65572c769d05f0","repo":"crowdsecurity/crowdsec","slug":"building-query-w-2c6557","errorCode":null,"errorMessage":"building query: %w","messagePattern":"building query: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiclient/allowlists_service.go","lineNumber":26,"sourceCode":"\n\tqs \"github.com/google/go-querystring/query\"\n\tlog \"github.com/sirupsen/logrus\"\n\n\t\"github.com/crowdsecurity/crowdsec/pkg/models\"\n)\n\ntype AllowlistsService service\n\ntype AllowlistListOpts struct {\n\tWithContent bool `url:\"with_content,omitempty\"`\n}\n\nfunc (s *AllowlistsService) List(ctx context.Context, opts AllowlistListOpts) (*models.GetAllowlistsResponse, *Response, error) {\n\tu := s.client.URLPrefix + \"/allowlists\"\n\n\tparams, err := qs.Values(opts)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"building query: %w\", err)\n\t}\n\n\tu += \"?\" + params.Encode()\n\n\treq, err := s.client.PrepareRequest(ctx, http.MethodGet, u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tallowlists := &models.GetAllowlistsResponse{}\n\n\tresp, err := s.client.Do(ctx, req, allowlists)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn allowlists, resp, nil\n}","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiclient/allowlists_service.go#L8-L44","documentation":"Returned by AllowlistsService.List when go-querystring fails to serialize the AllowlistListOpts struct into URL query parameters. A generic guard over the opts input; in practice it only fires if a url tag on the struct is invalid.","triggerScenarios":"Thrown at pkg/apiclient/allowlists_service.go:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use valid values for AllowlistListOpts (e.g. WithContent bool)","Check for corrupted option structs passed by the caller"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}