bilibili/flv.js · error · InvalidArgumentException
Invalid seekType in config: ${config.seekType}
Error message
Invalid seekType in config: ${config.seekType} What it means
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.
Source
Thrown at src/io/io-controller.js:235
}
_selectSeekHandler() {
let config = this._config;
if (config.seekType === 'range') {
this._seekHandler = new RangeSeekHandler(this._config.rangeLoadZeroStart);
} else if (config.seekType === 'param') {
let paramStart = config.seekParamStart || 'bstart';
let paramEnd = config.seekParamEnd || 'bend';
this._seekHandler = new ParamSeekHandler(paramStart, paramEnd);
} else if (config.seekType === 'custom') {
if (typeof config.customSeekHandler !== 'function') {
throw new InvalidArgumentException('Custom seekType specified in config but invalid customSeekHandler!');
}
this._seekHandler = new config.customSeekHandler();
} else {
throw new InvalidArgumentException(`Invalid seekType in config: ${config.seekType}`);
}
}
_selectLoader() {
if (this._config.customLoader != null) {
this._loaderClass = this._config.customLoader;
} else if (this._isWebSocketURL) {
this._loaderClass = WebSocketLoader;
} else if (FetchStreamLoader.isSupported()) {
this._loaderClass = FetchStreamLoader;
} else if (MozChunkedLoader.isSupported()) {
this._loaderClass = MozChunkedLoader;
} else if (RangeLoader.isSupported()) {
this._loaderClass = RangeLoader;
} else {
throw new RuntimeException('Your browser doesn\'t support xhr with arraybuffer responseType!');
}
}View on GitHub (pinned to 42343088f2)
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
Example fix
// before
const config = { seekType: 'byterange' }; // throws InvalidArgumentException
// after
const config = { seekType: 'range' }; Defensive patterns
Strategy: validation
Validate before calling
const VALID_SEEK_TYPES = ['range', 'param', 'custom'];
if (!VALID_SEEK_TYPES.includes(config.seekType)) {
throw new TypeError(`seekType must be one of ${VALID_SEEK_TYPES}, got: ${config.seekType}`);
} Type guard
const isValidSeekType = (t) => t === 'range' || t === 'param' || t === 'custom';
Try / catch
try {
const controller = new IOController(loaderClass, config, extraData);
} catch (e) {
if (e instanceof InvalidArgumentException && /Invalid seekType/.test(e.message)) {
config.seekType = 'range';
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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').
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Custom seekType specified in config but invalid customSeekHa
- FlvPlayer requires an flv MediaDataSource input!
- NativePlayer does't support flv MediaDataSource input!
AI-assisted analysis of bilibili/flv.js@42343088f2 (2026-09-01).
Data as JSON: /api/errors/ff3c30961b5efd03.
Report an issue: GitHub.