{"record":{"id":"9bbfc070849c7f14","repo":"portainer/portainer","slug":"failed-to-persist-git-sync-status-for-stack-d-w","errorCode":null,"errorMessage":"failed to persist git sync status for stack %d: %w","messagePattern":"failed to persist git sync status for stack (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/stacks/deployments/deploy.go","lineNumber":167,"sourceCode":"\n\tvar gitCommitChangedOrForceUpdate bool\n\n\tif !stack.FromAppTemplate {\n\t\tupdated, newHash, err := update.UpdateGitObject(ctx, gitService, fmt.Sprintf(\"stack:%d\", stack.ID), gitConfig, false, stack.ProjectPath)\n\t\tif err != nil {\n\t\t\tif txErr := datastore.UpdateTx(func(tx dataservices.DataStoreTx) error {\n\t\t\t\treturn workflows.SaveStackStatus(tx, userContext, stack.WorkflowID, stack.ID, gitSrc.ID, err)\n\t\t\t}); txErr != nil {\n\t\t\t\treturn fmt.Errorf(\"git check failed for stack %d: %w (and failed to persist status: %w)\", stack.ID, err, txErr)\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\n\t\tif txErr := datastore.UpdateTx(func(tx dataservices.DataStoreTx) error {\n\t\t\treturn workflows.SaveStackStatus(tx, userContext, stack.WorkflowID, stack.ID, gitSrc.ID, nil)\n\t\t}); txErr != nil {\n\t\t\treturn fmt.Errorf(\"failed to persist git sync status for stack %d: %w\", stack.ID, txErr)\n\t\t}\n\n\t\tif updated {\n\t\t\tgitConfig.ConfigHash = newHash\n\n\t\t\tstack.UpdateDate = time.Now().Unix()\n\t\t\tgitCommitChangedOrForceUpdate = updated\n\t\t}\n\n\t\tif stack.AutoUpdate != nil && stack.AutoUpdate.ForceUpdate {\n\t\t\tgitCommitChangedOrForceUpdate = true\n\t\t}\n\t}\n\n\tif !gitCommitChangedOrForceUpdate {\n\t\treturn nil\n\t}\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/stacks/deployments/deploy.go#L149-L185","documentation":"Error \"failed to persist git sync status for stack %d: %w\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/stacks/deployments/deploy.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}