{"record":{"id":"539435b7914bd4fe","repo":"GoogleContainerTools/skaffold","slug":"s-is-not-a-valid-resource-type-for-port-forwardin","errorCode":null,"errorMessage":"%s is not a valid resource type for port forwarding","messagePattern":"(.+?) is not a valid resource type for port forwarding","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/validation/validation.go","lineNumber":591,"sourceCode":"func validatePortForwardResources(cfg *parser.SkaffoldConfigEntry, pfrs []*latest.PortForwardResource) []ErrorWithLocation {\n\tvar errs []ErrorWithLocation\n\tvalidResourceTypes := map[string]struct{}{\n\t\t\"container\":             {},\n\t\t\"pod\":                   {},\n\t\t\"deployment\":            {},\n\t\t\"service\":               {},\n\t\t\"replicaset\":            {},\n\t\t\"replicationcontroller\": {},\n\t\t\"statefulset\":           {},\n\t\t\"daemonset\":             {},\n\t\t\"cronjob\":               {},\n\t\t\"job\":                   {},\n\t}\n\tfor i, pfr := range pfrs {\n\t\tresourceType := strings.ToLower(string(pfr.Type))\n\t\tif _, ok := validResourceTypes[resourceType]; !ok {\n\t\t\terrs = append(errs, ErrorWithLocation{\n\t\t\t\tError:    fmt.Errorf(\"%s is not a valid resource type for port forwarding\", pfr.Type),\n\t\t\t\tLocation: cfg.YAMLInfos.Locate(pfrs[i]),\n\t\t\t})\n\t\t}\n\t}\n\treturn errs\n}\n\n// validateJibPluginTypes makes sure that jib type is one of `maven`, or `gradle` if set.\nfunc validateJibPluginTypes(cfg *parser.SkaffoldConfigEntry, artifacts []*latest.Artifact) (cfgErrs []ErrorWithLocation) {\n\tfor i, a := range artifacts {\n\t\tif a.JibArtifact == nil || a.JibArtifact.Type == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tt := strings.ToLower(a.JibArtifact.Type)\n\t\tif t == \"maven\" || t == \"gradle\" {\n\t\t\tcontinue\n\t\t}\n\t\tcfgErrs = append(cfgErrs, ErrorWithLocation{","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/validation/validation.go#L573-L609","documentation":"validatePortForwardResources checks every portForward entry's resourceType against the allowed set: container, pod, deployment, service, replicaset, replicationcontroller, statefulset, daemonset, cronjob, job (case-insensitive). Any other type is rejected because Skaffold cannot resolve it into a Kubernetes object to port-forward.","triggerScenarios":"skaffold.yaml has a portForward resource whose type is misspelled or unsupported (e.g. 'pods', 'svc', 'ingress', 'StatefulSet ' with a trailing space isn't the issue since it's lowered — but 'ingress' is simply not in the set).","commonSituations":"Using Kubernetes short names ('svc', 'deploy'), plural forms ('pods'), or resource types Skaffold doesn't support like ingress or custom CRDs.","solutions":["Change resourceType to a supported singular kind: pod, deployment, service, replicaset, replicationcontroller, statefulset, daemonset, cronjob, job, or container","Replace short/plural names ('svc', 'pods') with the full singular kind","Remove the entry if the resource kind is unsupported (e.g. ingress) and port-forward manually with kubectl"],"exampleFix":"// before\nportForward:\n  - resourceType: svc\n    resourceName: api\n    port: 8080\n// after\nportForward:\n  - resourceType: service\n    resourceName: api\n    port: 8080","handlingStrategy":"validation","validationCode":"// Go: allowed port-forward resource types\nvar validResourceTypes = map[string]bool{\n\t\"container\": true, \"pod\": true, \"deployment\": true, \"service\": true,\n\t\"replicaset\": true, \"replicationcontroller\": true, \"statefulset\": true,\n\t\"daemonset\": true, \"cronjob\": true, \"job\": true,\n}\nfunc validPortForwardType(t string) bool { return validResourceTypes[strings.ToLower(t)] }","typeGuard":null,"tryCatchPattern":"if !validPortForwardType(resourceType) {\n\treturn fmt.Errorf(\"%q is not a valid port-forward resource type\", resourceType)\n}","preventionTips":["Use full singular Kubernetes kind names (service, deployment, pod) — not short names like svc/deploy","Stick to the supported list; ingress and CRDs are not port-forwardable via skaffold.yaml","Validate portForward blocks with 'skaffold diagnose' in CI"],"tags":["skaffold","port-forward","kubernetes","config-validation"],"backgroundTag":"invalid-resource-type","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}