{"record":{"id":"4eb6fe2d4e273101","repo":"mgth/LittleBigMouse","slug":"macro-delays-must-be-between-0-and-10000-ms","errorCode":null,"errorMessage":"Macro delays must be between 0 and 10000 ms.","messagePattern":"Macro delays must be between 0 and 10000 ms\\.","errorType":"validation","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs","lineNumber":21,"sourceCode":"namespace LittleBigMouse.Plugin.Vcp.Avalonia;\n\n/// <summary>Shared parser for Samsung and VIDAA remote-key macros.</summary>\npublic static class RemoteMacro\n{\n    public static IReadOnlyList<(string Key, TimeSpan DelayAfter)> Parse(string sequence)\n    {\n        var result = new List<(string Key, TimeSpan DelayAfter)>();\n        var tokens = sequence.Split(\n            [',', ';', '+', '\\n', '\\r'],\n            StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);\n\n        foreach (var token in tokens)\n        {\n            if (int.TryParse(token, out var milliseconds))\n            {\n                if (result.Count == 0) throw new FormatException(\"A delay must follow a KEY_ command.\");\n                if (milliseconds is < 0 or > 10000)\n                    throw new FormatException(\"Macro delays must be between 0 and 10000 ms.\");\n                result[^1] = (result[^1].Key, TimeSpan.FromMilliseconds(milliseconds));\n                continue;\n            }\n\n            var key = token.ToUpperInvariant();\n            if (!key.StartsWith(\"KEY_\", StringComparison.Ordinal) || key.Any(char.IsWhiteSpace))\n                throw new FormatException($\"Invalid remote key: {token}\");\n            result.Add((key, TimeSpan.FromMilliseconds(150)));\n        }\n\n        if (result.Count == 0) throw new FormatException(\"Enter at least one KEY_ command.\");\n        return result;\n    }\n}\n","sourceCodeStart":3,"sourceCodeEnd":36,"githubUrl":"https://github.com/mgth/LittleBigMouse/blob/7a42f01d47d99d223b8ee33ba4019af82adf1c48/LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs#L3-L36","documentation":"Thrown by RemoteMacro.Parse when a token parsed as an integer is treated as a delay following the previous KEY_ command but falls outside the allowed 0-10000 ms range. It fires whenever a user-supplied macro sequence contains a numeric token like '-5' or '20000', enforcing an upper bound so a macro cannot stall the remote-control session indefinitely.","triggerScenarios":"Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Edit the macro sequence so every numeric delay token is between 0 and 10000 milliseconds.","Split longer pauses into multiple consecutive delay tokens, e.g. 'KEY_POWER,10000,10000' instead of 'KEY_POWER,20000'.","Remove or correct malformed delay tokens such as negative or transposed numbers before saving the macro."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a42f01d47d99d223b8ee33ba4019af82adf1c48","analyzedAt":"2026-09-16T00:35:00.514Z","contentChangedAt":"2026-09-16T00:35:00.514Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}