gitlabhq/gitlabhq · error · Gitlab::Graphql::Errors::ArgumentError
#{global_id} is not a valid GitLab ID.
Error message
#{global_id} is not a valid GitLab ID. What it means
Error "#{global_id} is not a valid GitLab ID." thrown in gitlabhq/gitlabhq.
Source
Thrown at app/graphql/gitlab_schema.rb:145
# * it may not match the expected type (see below)
#
# Options:
# * :expected_type [Class] - the type of object this GlobalID should refer to.
# * :expected_type [[Class]] - array of the types of object this GlobalID should refer to.
#
# e.g.
#
# ```
# gid = GitlabSchema.parse_gid(my_string, expected_type: ::Project)
# project_id = gid.model_id
# gid.model_class == ::Project
# ```
def parse_gid(global_id, ctx = {})
expected_types = Array(ctx[:expected_type])
gid = GlobalID.parse(global_id)
unless gid
raise Gitlab::Graphql::Errors::ArgumentError,
"#{global_id} is not a valid GitLab ID."
end
if expected_types.any? && expected_types.none? do |type|
gid.model_class.ancestors.include?(type)
end
vars = { global_id: global_id, expected_types: expected_types.join(', ') }
msg = _('%{global_id} is not a valid ID for %{expected_types}.') % vars
raise Gitlab::Graphql::Errors::ArgumentError, msg
end
gid
end
# Parse an array of strings to an array of GlobalIDs, raising ArgumentError if there are problems
# with it.
# See #parse_gid
#View on GitHub (pinned to 55ee20384a)
When it happens
Trigger: Thrown at app/graphql/gitlab_schema.rb:145 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gitlabhq/gitlabhq@55ee20384a (2026-08-21).
Data as JSON: /api/errors/76ccc450a7d129b5.
Report an issue: GitHub.