{"record":{"id":"a3d45429d6034ae3","repo":"Devolutions/UniGetUI","slug":"only-queued-operations-can-be-reordered","errorCode":null,"errorMessage":"Only queued operations can be reordered.","messagePattern":"Only queued operations can be reordered\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/UniGetUI.Interface.IpcApi/IpcOperationApi.cs","lineNumber":238,"sourceCode":"        string normalizedRetryMode = NormalizeRetryMode(retryMode);\n        var availableRetryModes = GetRetryModes(tracked.Operation);\n        if (!availableRetryModes.Contains(ToRetryModeName(normalizedRetryMode)))\n        {\n            throw new InvalidOperationException(\n                $\"Retry mode \\\"{retryMode}\\\" is not supported for operation {operationId}.\"\n            );\n        }\n\n        tracked.Operation.Retry(normalizedRetryMode);\n        return IpcCommandResult.Success(\"retry-operation\");\n    }\n\n    public static IpcCommandResult ReorderOperation(string operationId, string action)\n    {\n        var tracked = GetTrackedOperation(operationId);\n        if (tracked.Operation.Status != OperationStatus.InQueue)\n        {\n            throw new InvalidOperationException(\n                \"Only queued operations can be reordered.\"\n            );\n        }\n\n        switch (NormalizeQueueAction(action))\n        {\n            case \"run-now\":\n                tracked.Operation.SkipQueue();\n                break;\n            case \"run-next\":\n                tracked.Operation.RunNext();\n                break;\n            case \"run-last\":\n                tracked.Operation.BackOfTheQueue();\n                break;\n            default:\n                throw new InvalidOperationException($\"Unsupported queue action \\\"{action}\\\".\");\n        }","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcOperationApi.cs#L220-L256","documentation":"Thrown by ReorderOperation when the operation's status is not OperationStatus.InQueue. Only operations waiting in the queue can be reordered. An operation that is Running, or has reached any terminal state (succeeded, failed, canceled), cannot be moved within the queue.","triggerScenarios":"Calling ReorderOperation for an operation whose status is Running or any terminal state. The operation is found (GetTrackedOperation succeeds) but is not InQueue. The AvailableQueueActions field on IpcOperationInfo is empty for non-queued operations, serving as the client-side guard.","commonSituations":"Operation started executing between the client's status check and the reorder call. Client shows queue controls for an operation that already left the queue. Attempting to reorder an operation that just completed.","solutions":["Check the operation status via GetOperation before calling ReorderOperation.","Use the AvailableQueueActions field — if empty, the operation is not reorderable.","Refresh the operation list after any queue change to get current positions."],"exampleFix":"// before\nIpcOperationApi.ReorderOperation(opId, \"run-now\");\n// after\nvar info = IpcOperationApi.GetOperation(opId);\nif (info.AvailableQueueActions.Contains(\"run-now\"))\n    IpcOperationApi.ReorderOperation(opId, \"run-now\");","handlingStrategy":"validation","validationCode":"var info = IpcOperationApi.GetOperation(operationId);\nif (info.AvailableQueueActions.Count == 0)\n    throw new InvalidOperationException($\"Operation {operationId} is not queued and cannot be reordered.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate reorder UI on AvailableQueueActions being non-empty.","Only InQueue operations can be reordered.","Refresh the operation list after any queue change to get current state."],"tags":["operations","ipc","validation","queue","state-machine"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}