GoogleContainerTools/skaffold · error

unable to monitor resource. Unknown type %s

Error message

unable to monitor resource. Unknown type %s

What it means

When checking Cloud Run resource status, skaffold inspects each monitored resource's type (service, job, worker pool) and constructs the corresponding status-checker sub-resource. If the resource's type string matches none of the known types, `check` returns this error because it cannot determine how to monitor the resource.

Source

Thrown at pkg/skaffold/deploy/cloudrun/status.go:89

func (s *Monitor) Check(ctx context.Context, out io.Writer) error {
	_, err, _ := s.singleRun.Do(s.labeller.GetRunID(), func() (interface{}, error) {
		return struct{}{}, s.check(ctx, out)
	})
	return err
}
func (s *Monitor) check(ctx context.Context, out io.Writer) error {
	resources := make([]*runResource, len(s.Resources))
	for i, resource := range s.Resources {
		var sub runSubresource
		switch resource.Type() {
		case typeService:
			sub = &runServiceResource{path: resource.String()}
		case typeJob:
			sub = &runJobResource{path: resource.String()}
		case typeWorkerPool:
			sub = &runWorkerPoolResource{path: resource.String()}
		default:
			return fmt.Errorf("unable to monitor resource. Unknown type %s", resource.Type())
		}
		resources[i] = &runResource{resource: resource, sub: sub}
	}
	c := newCounter(len(resources))
	cctx, cancel := context.WithCancel(ctx)
	defer cancel()
	var wg sync.WaitGroup
	var exitStatusOnce sync.Once
	exitStatus := proto.StatusCode_STATUSCHECK_SUCCESS
	for _, resource := range resources {
		wg.Add(1)
		go func(resource *runResource) {
			defer wg.Done()
			resource.pollResourceStatus(cctx, s.statusCheckDeadline, s.pollPeriod, s.clientOptions, true, s.tolerateFailures)
			c.markComplete()
			res := resource.status
			if res.ae.ErrCode != proto.StatusCode_STATUSCHECK_SUCCESS {
				exitStatusOnce.Do(func() { exitStatus = res.ae.ErrCode })

View on GitHub (pinned to a1189de023)

Solutions

  1. Fix the resource type in skaffold.yaml (valid values: service, job, workerPool)
  2. Upgrade skaffold to the latest version, which may support newer Cloud Run resource types
  3. If defining resources programmatically/via API, ensure Type() returns one of the supported constants

Example fix

// before
deploy:
  cloudrun:
    resources:
      - type: servcie

// after
deploy:
  cloudrun:
    resources:
      - type: service
Defensive patterns

Strategy: validation

Validate before calling

allowed := map[string]bool{"service": true, "job": true, "workerPool": true}
for _, r := range cfg.Deploy.CloudRun.Resources {
    if !allowed[r.Type] {
        return fmt.Errorf("unsupported cloudrun resource type %q", r.Type)
    }
}

Prevention

When it happens

Trigger: A resource definition under deploy.cloudrun (or the resource parsed from `gcloud` output / config) has a Type() other than "service", "job", or "workerPool" — e.g. a typo in the manifest kind or an unsupported Cloud Run resource type passed to the status monitor.

Common situations: Typo in skaffold.yaml cloudrun resource type; newer Cloud Run resource kind not supported by the installed skaffold version; programmatically constructed runResource with an unexpected type string.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/70eb5ca3e3a62906. Report an issue: GitHub.