{"record":{"id":"ff3c30961b5efd03","repo":"bilibili/flv.js","slug":"invalid-seektype-in-config-config-seektype","errorCode":null,"errorMessage":"Invalid seekType in config: ${config.seekType}","messagePattern":"Invalid seekType in config: (.+?)","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/io/io-controller.js","lineNumber":235,"sourceCode":"    }\n\n    _selectSeekHandler() {\n        let config = this._config;\n\n        if (config.seekType === 'range') {\n            this._seekHandler = new RangeSeekHandler(this._config.rangeLoadZeroStart);\n        } else if (config.seekType === 'param') {\n            let paramStart = config.seekParamStart || 'bstart';\n            let paramEnd = config.seekParamEnd || 'bend';\n\n            this._seekHandler = new ParamSeekHandler(paramStart, paramEnd);\n        } else if (config.seekType === 'custom') {\n            if (typeof config.customSeekHandler !== 'function') {\n                throw new InvalidArgumentException('Custom seekType specified in config but invalid customSeekHandler!');\n            }\n            this._seekHandler = new config.customSeekHandler();\n        } else {\n            throw new InvalidArgumentException(`Invalid seekType in config: ${config.seekType}`);\n        }\n    }\n\n    _selectLoader() {\n        if (this._config.customLoader != null) {\n            this._loaderClass = this._config.customLoader;\n        } else if (this._isWebSocketURL) {\n            this._loaderClass = WebSocketLoader;\n        } else if (FetchStreamLoader.isSupported()) {\n            this._loaderClass = FetchStreamLoader;\n        } else if (MozChunkedLoader.isSupported()) {\n            this._loaderClass = MozChunkedLoader;\n        } else if (RangeLoader.isSupported()) {\n            this._loaderClass = RangeLoader;\n        } else {\n            throw new RuntimeException('Your browser doesn\\'t support xhr with arraybuffer responseType!');\n        }\n    }","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/bilibili/flv.js/blob/42343088f22619cf014a057b3878fe3d320016a6/src/io/io-controller.js#L217-L253","documentation":"IOController._selectSeekHandler accepts only known seekType values ('range', 'param', 'custom'); anything else reaches the final else branch and throws an InvalidArgumentException naming the invalid value. It prevents silent misconfiguration of how range requests are built.","triggerScenarios":"Instantiating IOController with config.seekType set to a misspelled or unsupported string such as 'Range', 'bytes', 'params', or left as an arbitrary value from user input.","commonSituations":"Typo in the config value, configuration loaded from JSON/user settings with an unexpected string, upgrading the library and using a seekType that was never supported, camelCase/kebab-case mismatches ('chunked', 'byterange').","solutions":["Set seekType to one of 'range' | 'param' | 'custom'","Log/inspect config.seekType before constructing to catch bad values from dynamic config sources","Use 'range' (Range requests via Range header) as the default for progressive media","If custom behavior is needed, use seekType:'custom' with a valid customSeekHandler"],"exampleFix":"// before\nconst config = { seekType: 'byterange' }; // throws InvalidArgumentException\n// after\nconst config = { seekType: 'range' };","handlingStrategy":"validation","validationCode":"const VALID_SEEK_TYPES = ['range', 'param', 'custom'];\nif (!VALID_SEEK_TYPES.includes(config.seekType)) {\n  throw new TypeError(`seekType must be one of ${VALID_SEEK_TYPES}, got: ${config.seekType}`);\n}","typeGuard":"const isValidSeekType = (t) => t === 'range' || t === 'param' || t === 'custom';","tryCatchPattern":"try {\n  const controller = new IOController(loaderClass, config, extraData);\n} catch (e) {\n  if (e instanceof InvalidArgumentException && /Invalid seekType/.test(e.message)) {\n    config.seekType = 'range';\n  }\n}","preventionTips":["Whitelist-validate seekType from any dynamic/user-supplied config source","Watch for case sensitivity: 'Range' is invalid, 'range' is valid","Document allowed values where configs are authored (JSON schemas, TS literal types)","Centralize player config construction in one validated helper"],"tags":["config","seek","invalid-argument"],"backgroundTag":"invalid-config-value","analyzedSha":"42343088f22619cf014a057b3878fe3d320016a6","analyzedAt":"2026-09-01T00:27:28.147Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}