rancher/rancher · error

invalid endpoint %v

Error message

invalid endpoint %v

What it means

Returned by the default branch of the GKE handler's switch over resourceType: none of the known sub-endpoint names matched, so the handler responds with HTTP 404 ('invalid endpoint <resourceType>'). It means the router itself was reached but the requested sub-resource name is not one of the supported cases (gkeMachineTypes, gkeNetworks, gkeSubnetworks, gkeServiceAccounts, gkeVersions, gkeSharedSubnets, gkeFamiliesFromProject, gkeImageFamilies, gkeDiskTypes).

Source

Thrown at pkg/api/norman/customization/gke/handler.go:183

		}

		showDeprecated := strings.ToLower(req.URL.Query().Get("showDeprecated")) == "true"

		if serialized, errCode, err = listImageFamilyForProject(req.Context(), capa, imageProject, imageFamily, showDeprecated); err != nil {
			logrus.Errorf("[gke-handler] error getting images from image family: %v", err)
			handleErr(writer, errCode, err)
			return
		}
		writer.Write(serialized)
	case "gkeDiskTypes":
		if serialized, errCode, err = listDiskTypes(req.Context(), capa); err != nil {
			logrus.Errorf("[gke-handler] error getting disk types: %v", err)
			handleErr(writer, errCode, err)
			return
		}
		writer.Write(serialized)
	default:
		handleErr(writer, httperror.NotFound.Status, fmt.Errorf("invalid endpoint %v", resourceType))
	}
}

func (h *handler) getCloudCredential(req *http.Request, cap *Capabilities, credID string, projectIDRequired bool) (int, error) {
	ns, name := ref.Parse(credID)
	if ns == "" || name == "" {
		logrus.Errorf("[GKE] invalid cloud credential ID %s", credID)
		return http.StatusBadRequest, fmt.Errorf("invalid cloud credential ID %s", credID)
	}

	var accessCred client.CloudCredential // var to check access
	if err := access.ByID(h.generateAPIContext(req), &schema.Version, client.CloudCredentialType, credID, &accessCred); err != nil {
		apiError, ok := err.(*httperror.APIError)
		if !ok {
			return httperror.NotFound.Status, err
		}
		if apiError.Code.Status == httperror.NotFound.Status {
			return httperror.InvalidBodyContent.Status, fmt.Errorf("cloud credential not found")

View on GitHub (pinned to 932558d4e6)

Solutions

  1. Correct the resourceType value to one of the supported case-sensitive names (gkeMachineTypes, gkeNetworks, gkeSubnetworks, gkeServiceAccounts, gkeVersions, gkeSharedSubnets, gkeFamiliesFromProject, gkeImageFamilies, gkeDiskTypes)
  2. If the name looks right, check exact casing and no trailing whitespace/encoding artifacts
  3. On version skew, align the client (dashboard/extension) version with the Rancher server version

Example fix

// before
GET /v3/gke/endpoints?resourceType=gkeDiskType&cloudCredentialId=...
// after
GET /v3/gke/endpoints?resourceType=gkeDiskTypes&cloudCredentialId=...
Defensive patterns

Strategy: type-guard

Validate before calling

const VALID_RESOURCE_TYPES = new Set([
  'gkeMachineTypes', 'gkeNetworks', 'gkeSubnetworks', 'gkeServiceAccounts',
  'gkeVersions', 'gkeSharedSubnets', 'gkeFamiliesFromProject', 'gkeImageFamilies', 'gkeDiskTypes'
]);
if (!VALID_RESOURCE_TYPES.has(resourceType)) {
  throw new Error(`unsupported resourceType '${resourceType}'; valid: ${[...VALID_RESOURCE_TYPES].join(', ')}`);
}

Type guard

const isGkeResourceType = (v) => typeof v === 'string' && new Set(['gkeMachineTypes','gkeNetworks','gkeSubnetworks','gkeServiceAccounts','gkeVersions','gkeSharedSubnets','gkeFamiliesFromProject','gkeImageFamilies','gkeDiskTypes']).has(v);

Try / catch

try { const res = await fetch(url); if (res.status === 404) { checkResourceTypeSpelling(resourceType); } } catch (e) { reportNetwork(e); }

Prevention

When it happens

Trigger: resourceType misspelled or wrong case, e.g. gkeMachineType (singular) or GKE disk types; requesting a sub-endpoint that exists only in a newer/older Rancher version than the one serving the request.

Common situations: Dashboard/backend version skew after partial upgrade; typos in custom scripts; renamed endpoints across Rancher releases; clients hardcoding a resource list that drifts from the server.

Related errors


AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16). Data as JSON: /api/errors/d332eef4c67a8fe3. Report an issue: GitHub.