pinpoint-apm/pinpoint · error · IllegalArgumentException
the key must contain ':' key:
Error message
the key must contain ':' key:
What it means
RedisKVPubChannelProvider.getPubChannel expects pub-channel keys of the form '<duration>:<channelName>' (e.g. PT10M:myChannel), split by KeyValueTokenizer.tokenize(key, ":"). If the key has no ':' the tokenization fails and it throws IllegalArgumentException, because the expiry Duration cannot be parsed from the key.
Solutions
- Pass the key as '<ISO-8601 duration>:<channel>' — e.g. PT10M:myChannel
- Add the missing ':' and Duration prefix at the call site that builds the key
- Pre-check key.contains(":") before calling getPubChannel
Example fix
// before
PubChannel ch = provider.getPubChannel("myChannel");
// after
PubChannel ch = provider.getPubChannel("PT10M:myChannel"); Defensive patterns
Strategy: validation
Validate before calling
if (key == null || !key.contains(":")) {
throw new IllegalArgumentException("pub channel key must be '<duration>:<channel>'");
} Try / catch
try { PubChannel ch = provider.getPubChannel(key); } catch (IllegalArgumentException e) { log.warn("bad pub channel key: {}", key); } Prevention
- Always build keys as '<ISO-8601 duration>:<channelName>'
- Centralize key construction in one helper
- Add a contains(':') assertion at key-construction sites
When it happens
Trigger: Calling getPubChannel with a key lacking the ':' separator — e.g. getPubChannel("myChannel") instead of getPubChannel("PT10M:myChannel").
Common situations: Callers constructing the key from just the channel name; config where the duration prefix was dropped; refactor that changed the key format contract between producer and provider.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/9f48c3cfdc47fb7f.
Report an issue: GitHub.
Appendix: source
Thrown at redis/src/main/java/com/navercorp/pinpoint/channel/redis/kv/RedisKVPubChannelProvider.java:41
import java.time.Duration;
import java.util.Objects;
/**
* @author youngjin.kim2
*/
class RedisKVPubChannelProvider implements PubChannelProvider {
private final RedisTemplate<String, String> template;
RedisKVPubChannelProvider(RedisTemplate<String, String> template) {
this.template = Objects.requireNonNull(template, "template");
}
@Override
public PubChannel getPubChannel(String key) {
KeyValueTokenizer.KeyValue keyValue = KeyValueTokenizer.tokenize(key, ":");
if (keyValue == null) {
throw new IllegalArgumentException("the key must contain ':' key:" + key);
}
Duration expire = Duration.parse(keyValue.getKey());
return new RedisKVPubChannel(this.template, expire.toMillis(), keyValue.getValue());
}
}
View on GitHub (pinned to 744c3d3075)