{"record":{"id":"e38d6394a06b215e","repo":"argoproj/argo-workflows","slug":"failed-to-get-workflowtemplate-s-s-v","errorCode":null,"errorMessage":"Failed to get WorkflowTemplate %s/%s: %v","messagePattern":"Failed to get WorkflowTemplate (.+?)/(.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/artifacts/artifact_server.go","lineNumber":136,"sourceCode":"\tif !allowed {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\tallowed, err = auth.CanI(ctx, \"create\", \"workflows\", namespace, \"\")\n\tif err != nil {\n\t\ta.serverInternalError(ctx, err, w)\n\t\treturn\n\t}\n\tif !allowed {\n\t\thttp.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// Get WorkflowTemplate to find artifact configuration\n\twfClient := auth.GetWfClient(ctx)\n\twfTemplate, err := wfClient.ArgoprojV1alpha1().WorkflowTemplates(namespace).Get(ctx, workflowTemplateName, metav1.GetOptions{})\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to get WorkflowTemplate %s/%s: %v\", namespace, workflowTemplateName, err), http.StatusNotFound)\n\t\treturn\n\t}\n\tif validateErr := a.instanceIDService.Validate(wfTemplate); validateErr != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Enforce a hard cap on the total request body size before buffering any\n\t// of it, so a caller cannot exhaust server disk/memory with an oversized upload.\n\tmaxUploadBytes, err := env.GetInt(\"ARGO_SERVER_MAX_ARTIFACT_UPLOAD_BYTES\", 1<<30)\n\tif err != nil {\n\t\ta.serverInternalError(ctx, err, w)\n\t\treturn\n\t}\n\tr.Body = http.MaxBytesReader(w, r.Body, int64(maxUploadBytes))\n\n\t// mime/multipart.ReadForm already removes temp files on parse error, but\n\t// registering cleanup here makes the handler's correctness independent of","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/artifacts/artifact_server.go#L118-L154","documentation":"The handler fetches the WorkflowTemplate with the caller's own k8s client (auth.GetWfClient) so the user's RBAC applies. If the GET fails (template missing, no permission, bad namespace), it returns 404 with a message including the error text. Note the instance-ID mismatch case is deliberately masked as a bare 404 to avoid leaking existence.","triggerScenarios":"WorkflowTemplate does not exist in the namespace; caller lacks 'get' on workflowtemplates (RBAC error surfaced as 404); typo in template name; controller-configured instanceID does not match the template's metadata (separate bare-404 path).","commonSituations":"Templates deployed to a different namespace than the upload URL; name typos; CRD not installed or argo namespace misconfigured; multi-tenant setups where instanceID labels differ.","solutions":["Verify the template exists: kubectl get workflowtemplate <name> -n <namespace>","Use the exact namespace from the template's location in the URL","Check RBAC if the raw error says 'forbidden' — the caller needs workflowtemplates/get","If using instanceID, confirm the template carries the expected workflow-controller instanceID label"],"exampleFix":"# before\ncurl -X POST -F 'file=@d.bin' .../upload-artifacts/prod/my-template/art\n# after (template actually lives in argo namespace)\ncurl -X POST -F 'file=@d.bin' .../upload-artifacts/argo/my-template/art","handlingStrategy":"validation","validationCode":"kubectl get workflowtemplate <name> -n <namespace> || \\\n  echo \"template missing — fix name/namespace before uploading\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm template existence and namespace before uploads (kubectl get workflowtemplate)","Remember the 404 message may wrap an RBAC error — inspect the embedded error text","Sync template deployment with the same namespace used in upload URLs","If instanceID is used, keep templates labeled consistently to avoid the masked 404"],"tags":["http-404","workflowtemplate","kubernetes","rest"],"backgroundTag":"resource-not-found","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}