diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 8d3a4c884..a32f276a8 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -1392,6 +1392,12 @@ var sectorsRemoveCmd = &cli.Command{ return xerrors.Errorf("could not parse sector number: %w", err) } + // Check if the sector exists + _, err = minerAPI.SectorsStatus(ctx, abi.SectorNumber(id), false) + if err != nil { + return xerrors.Errorf("sectorID %d has not been created yet: %w", id, err) + } + return minerAPI.SectorRemove(ctx, abi.SectorNumber(id)) }, }