You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GCP CLI管理Tag Binding时遇INVALID_ARGUMENT错误求助

GCP标签绑定操作报错处理

问题情况

使用GCP命令行工具执行标签绑定的列出与创建操作时,均触发INVALID_ARGUMENT错误。

列出标签绑定命令及错误

执行命令:

gcloud beta resource-manager tags bindings list --parent=projects/xxxx --location=northamerica-northeast1

返回错误:

ERROR: (gcloud.beta.resource-manager.tags.bindings.list) INVALID_ARGUMENT: Request contains an invalid argument.
- '@type': type.googleapis.com/google.rpc.BadRequest
  fieldViolations:
  - description: Must be a valid One Platform resource name of a tag compatible regional
      resource
    field: binding.resource
  - description: Resource type not supported in location northamerica-northeast1
    field: binding.resource

创建标签绑定命令及错误

执行命令:

gcloud resource-manager tags bindings create --tag-value=tagValues/xxx --parent=//cloudresourcemanager.googleapis.com/projects/xxx/locations/northamerica-northeast1/functions/function-1-test --location=northamerica-northeast

触发与上述完全相同的错误。

问题原因及修复方案

  1. 参数格式与地域支持问题

    • --parent参数格式错误:列出标签绑定时,--parent必须指定兼容标签的区域资源完整名称,不能仅填projects/xxxx;创建操作的--parent无需前缀//cloudresourcemanager.googleapis.com/,直接使用资源的短名称格式即可。
    • 地域不支持:northamerica-northeast1地域可能不支持当前操作的资源类型(比如Cloud Functions),需要确认该资源类型在目标地域是否开放标签绑定功能,或更换为支持的地域。
  2. 修正后的命令示例

    • 列出标签绑定(以Cloud Functions为例):
      gcloud beta resource-manager tags bindings list --parent=projects/xxx/locations/northamerica-northeast1/functions/function-1-test
      
    • 创建标签绑定:
      gcloud resource-manager tags bindings create --tag-value=tagValues/xxx --parent=projects/xxx/locations/northamerica-northeast1/functions/function-1-test
      

    若northamerica-northeast1确实不支持该资源的标签绑定,需更换为官方文档标注支持的地域(如us-central1)。

内容的提问来源于stack exchange,提问作者Gaurang Shah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 01:52:35