alibaba/canal · critical · PositionNotFoundException

position not found!

Error message

position not found!

What it means

Thrown as PositionNotFoundException by RdsLocalBinlogEventParser.start() when findStartPosition(null) returns null — meaning no valid binlog start position could be determined from the configured LogPositionManager. This prevents the parser from knowing where to begin reading RDS binlog backups.

Source

Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/RdsLocalBinlogEventParser.java:57

    public RdsLocalBinlogEventParser(){
    }

    public void start() throws CanalParseException {
        try {
            Assert.notNull(accesskey);
            Assert.notNull(secretkey);
            Assert.notNull(instanceId);
            Assert.notNull(url);
            Assert.notNull(directory);

            if (endTime == null) {
                endTime = System.currentTimeMillis();
            }

            EntryPosition entryPosition = findStartPosition(null);
            if (entryPosition == null) {
                throw new PositionNotFoundException("position not found!");
            }
            Long startTimeInMill = entryPosition.getTimestamp();
            if (startTimeInMill == null || startTimeInMill <= 0) {
                throw new PositionNotFoundException("position timestamp is empty!");
            }

            startTime = startTimeInMill;
            List<BinlogFile> binlogFiles = RdsBinlogOpenApi.listBinlogFiles(url,
                accesskey,
                secretkey,
                instanceId,
                new Date(startTime),
                new Date(endTime));
            if (binlogFiles.isEmpty()) {
                throw new CanalParseException("start timestamp : " + startTimeInMill + " binlog files is empty");
            }

            binlogDownloadQueue = new BinlogDownloadQueue(binlogFiles, batchFileSize, directory);

View on GitHub (pinned to 87be50e876)

Solutions

  1. Set a default EntryPosition with a valid timestamp before starting, or configure the LogPositionManager with a seed position.
  2. Ensure the destination name matches what was previously used so positions can be recovered.
  3. If using Zookeeper/File position manager, verify the position data exists and is readable.
  4. Configure canal.instance.master.timestamp or equivalent to provide a fallback start timestamp.
Defensive patterns

Strategy: validation

Validate before calling

// Before starting, ensure a position is available
EntryPosition pos = logPositionManager.getLatestIndexBy(destination);
if (pos == null) {
    // seed a default position with a valid timestamp
    pos = new EntryPosition();
    pos.setTimestamp(System.currentTimeMillis() - 86400000L); // yesterday
    pos.setJournalName("mysql-bin.000001");
    pos.setPosition(4L);
    logPositionManager.persistLogPosition(destination, buildLogPosition(pos));
}

Try / catch

try {
    parser.start();
} catch (PositionNotFoundException e) {
    if (e.getMessage().contains("position not found")) {
        // seed a default position and retry
    }
}

Prevention

When it happens

Trigger: Starting RdsLocalBinlogEventParser when the LogPositionManager (memory, file, or zookeeper-based) has no previously persisted position for this destination, and no default start position is configured. Occurs on first startup or after clearing position data.

Common situations: First-time deployment of canal with RDS local binlog mode without a pre-configured start position; the zookeeper position node was deleted; canal meta data was wiped; the destination name changed between restarts so the old position is not found.

Related errors


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/e72993c645b417d9. Report an issue: GitHub.