AlistGo/alist · warning

ticket is required

Error message

ticket is required

What it means

getExportTask requires the ticket returned by createExportTask to poll export status (ExportTask.Get with Ticket+Token). A blank ticket after trimming means the status request is malformed by construction, so the driver rejects it before touching the API. Pure request-validation on the export status payload.

Source

Thrown at drivers/lark/other.go:188

		Type:    docType,
		Formats: larkExportOptions(docType),
	}
	switch docType {
	case larkdrive.TypeSheet:
		out.SubResources, err = c.listSheetSubResources(ctx, token)
	case larkdrive.TypeBitable:
		out.SubResources, err = c.listBitableSubResources(ctx, token)
	}
	if err != nil {
		out.SubResourceError = err.Error()
	}
	return out, nil
}

func (c *Lark) getExportTask(ctx context.Context, obj model.Obj, req larkExportStatusReq) (*LarkExportStatusResp, error) {
	ticket := strings.TrimSpace(req.Ticket)
	if ticket == "" {
		return nil, errors.New("ticket is required")
	}
	token, ok := c.getObjToken(ctx, obj.GetPath())
	if !ok {
		return nil, errors.WithStack(errors.New("lark file token not found"))
	}
	resp, err := doDrive(ctx, c, func(opts ...larkcore.RequestOptionFunc) (*larkdrive.GetExportTaskResp, error) {
		return c.client.Drive.V1.ExportTask.Get(ctx,
			larkdrive.NewGetExportTaskReqBuilder().Ticket(ticket).Token(token).Build(), opts...)
	})
	if err != nil {
		return nil, err
	}
	if !resp.Success() {
		return nil, larkAPIError(resp)
	}
	if resp.Data == nil || resp.Data.Result == nil {
		return nil, errors.New("lark export task response missing result")
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Always obtain the ticket from createExportTask's response and pass it verbatim to the status call
  2. Validate req.Ticket is non-blank client-side before submitting
  3. Check the JSON field name/case matches larkExportStatusReq's tags

Example fix

// before
resp, err := c.getExportTask(ctx, obj, larkExportStatusReq{})
// after
if strings.TrimSpace(createResp.Ticket) == "" {
	return errors.New("export create returned no ticket")
}
resp, err := c.getExportTask(ctx, obj, larkExportStatusReq{Ticket: createResp.Ticket})
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(req.Ticket) == "" {
	return errors.New("export status requires the ticket from createExportTask")
}

Type guard

func hasExportTicket(req larkExportStatusReq) bool {
	return strings.TrimSpace(req.Ticket) != ""
}

Prevention

When it happens

Trigger: larkExportStatusReq submitted with an empty/whitespace ticket field — client lost the ticket from the create step, JSON field name mismatch when hand-crafting the request, or the create response was never persisted.

Common situations: Frontend form for export status not carrying the ticket through; API consumer serializing the field with the wrong key; stateless caller that skipped the create step.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/26c34f5cef2fea00. Report an issue: GitHub.