paascloud/paascloud-master · error · TpcBizException

TPC10050002

TPC10050002

Error message

TPC10050002

What it means

TPC10050002 means no TPC MQ message exists for the given messageKey. confirmAndSendMessage looks the message up by key and throws when the lookup returns null, so the confirm-and-send flow cannot proceed.

Solutions

  1. Confirm the messageKey matches exactly the key returned/stored when the message was created.
  2. Verify the message record still exists (tpc_mq_message table) and hasn't been deleted by cleanup jobs.
  3. Ensure the same environment/database is used for save and confirm.
  4. Call saveMessageWaitingConfirm first when the message hasn't been pre-stored.

Example fix

// before
tpcMqMessageService.confirmAndSendMessage(messageKey); // throws if key unknown
// after
TpcMqMessageDto dto = new TpcMqMessageDto();
dto.setMessageKey(key);
dto.setMessageTopic(topic);
tpcMqMessageService.saveMessageWaitingConfirm(dto);
tpcMqMessageService.confirmAndSendMessage(key);
Defensive patterns

Strategy: validation

Validate before calling

// verify the key was stored: query the list of reliable messages or persist the key when saving
boolean known = storedKeys.contains(messageKey);

Try / catch

try {
    tpcMqMessageService.confirmAndSendMessage(messageKey);
} catch (TpcBizException e) {
    if ("TPC10050002".equals(e.getMessage())) { /* recreate or requeue the message */ }
    throw e;
}

Prevention

When it happens

Trigger: Calling confirmAndSendMessage with a messageKey that was never saved (no prior saveMessageWaitingConfirm), a typo'd key, or a key whose row was deleted/purged.

Common situations: Sender uses a locally generated key that differs from the stored one; message already processed and deleted; environment mismatch pointing at a different database.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/d30c304db5353b1e. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-tpc/src/main/java/com/paascloud/provider/service/impl/TpcMqMessageServiceImpl.java:88

	public void saveMessageWaitingConfirm(TpcMqMessageDto messageDto) {

		if (StringUtils.isEmpty(messageDto.getMessageTopic())) {
			throw new TpcBizException(ErrorCodeEnum.TPC10050001);
		}

		Date now = new Date();
		TpcMqMessage message = new ModelMapper().map(messageDto, TpcMqMessage.class);
		message.setMessageStatus(MqSendStatusEnum.WAIT_SEND.sendStatus());
		message.setUpdateTime(now);
		message.setCreatedTime(now);
		tpcMqMessageMapper.insertSelective(message);
	}

	@Override
	public void confirmAndSendMessage(String messageKey) {
		final TpcMqMessage message = tpcMqMessageMapper.getByMessageKey(messageKey);
		if (message == null) {
			throw new TpcBizException(ErrorCodeEnum.TPC10050002);
		}

		TpcMqMessage update = new TpcMqMessage();
		update.setMessageStatus(MqSendStatusEnum.SENDING.sendStatus());
		update.setId(message.getId());
		update.setUpdateTime(new Date());
		tpcMqMessageMapper.updateByPrimaryKeySelective(update);
		// 创建消费待确认列表
		this.createMqConfirmListByTopic(message.getMessageTopic(), message.getId(), message.getMessageKey());
		// 直接发送消息
		this.directSendMessage(message.getMessageBody(), message.getMessageTopic(), message.getMessageTag(), message.getMessageKey(), message.getProducerGroup(), message.getDelayLevel());
	}

	@Override
	public void saveAndSendMessage(TpcMqMessageDto tpcMqMessageDto) {
		if (StringUtils.isEmpty(tpcMqMessageDto.getMessageTopic())) {
			throw new TpcBizException(ErrorCodeEnum.TPC10050001);
		}

View on GitHub (pinned to 781281a950)