{"record":{"id":"e94b865798f8707d","repo":"danbooru/danbooru","slug":"you-cannot-search-for-more-than-currentuser-tag","errorCode":null,"errorMessage":"You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time.","messagePattern":"You cannot search for more than #(.+?) tags at a time\\.","errorType":"http","errorClass":"PostQuery::TagLimitError","httpStatus":422,"severity":"error","filePath":"app/logical/post_query.rb","lineNumber":321,"sourceCode":"    def exact_count(timeout)\n      Post.with_timeout(timeout) do\n        posts.count\n      end\n    end\n\n    def count_cache_key\n      if is_user_dependent_search?\n        \"post-count-for-user:#{current_user.id.to_i}:#{to_s}\"\n      else\n        \"post-count:#{to_s}\"\n      end\n    end\n  end\n\n  concerning :ValidationMethods do\n    def validate_tag_limit!\n      return if is_empty_search? || is_simple_tag?\n      raise TagLimitError if tag_limit.present? && term_count > tag_limit\n    end\n\n    def validate_metatags!\n      return if is_empty_search? || is_simple_tag?\n      return if metatags.empty?\n\n      order_metatags = select_metatags(*ORDER_METATAGS).map(&:to_s).map(&:downcase).uniq\n      raise Error, \"#{order_metatags.to_sentence} can't be used together.\" if order_metatags.size > 1\n\n      SINGLETON_METATAGS.each do |name|\n        metatag = select_metatags(name).first\n        raise Error, \"'#{name}:' can't be used more than once.\" if select_metatags(name).map(&:to_s).map(&:downcase).uniq.size > 1\n        raise Error, \"'#{metatag}' can't be negated.\" if metatag&.parents&.any?(&:not?)\n        raise Error, \"'#{metatag}' can't be used with the 'or' operator.\" if metatag&.parents&.any?(&:or?)\n      end\n    end\n\n    # The number of unique tags, wildcards, and metatags in the search, excluding metatags that don't count against the user's tag limit.","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/danbooru/danbooru/blob/91fec095644078f87729db85d8f7486de5daf83d/app/logical/post_query.rb#L303-L339","documentation":"Error \"You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time.\" thrown in danbooru/danbooru.","triggerScenarios":"Thrown at app/logical/post_query.rb:321 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number of tags in the search to at most the limit shown in the message.","Split the search into multiple smaller searches.","Upgrade the account to raise the tag query limit, if applicable."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"91fec095644078f87729db85d8f7486de5daf83d","analyzedAt":"2026-08-24T06:18:22.875Z","schemaVersion":2},"datasetVersion":"2026-08-24T07:17:09.176Z"}