can1357/oh-my-pi · error · Error
owncloud share creation returned an unsuccessful OCS status
Error message
owncloud share creation returned an unsuccessful OCS status
What it means
Thrown after a successful ownCloud share-creation API call when the OCS envelope's meta.statuscode is not 100 (the OCS "ok" code). The HTTP request may have succeeded, but the WebDAV PUT succeeded and the share request itself reports failure server-side (e.g. the file was not found or sharing is forbidden), so the upload cannot produce a public URL.
Source
Thrown at packages/coding-agent/src/blob-broker/uploaders-self-hosted.ts:335
const shareForm = new FormData();
shareForm.append("path", `/${parts.join("/")}`);
shareForm.append("shareType", "3");
shareForm.append("permissions", "1");
if (expiryInfo.expireDate) shareForm.append("expireDate", expiryInfo.expireDate);
const shareResponse = await expectOk(
await requestFetch(
`${endpoint(host, "ocs", "v1.php", "apps", "files_sharing", "api", "v1", "shares")}?format=json`,
{
method: "POST",
headers: requestHeaders,
body: shareForm,
},
),
"owncloud",
);
const share = ownCloudShare(await shareResponse.json());
if (share.statusCode !== 100 && share.statusCode !== "100") {
throw new Error("owncloud share creation returned an unsuccessful OCS status");
}
const url = preview
? `${share.url.replace(/\/$/, "")}/preview`
: direct
? `${share.url.replace(/\/$/, "")}/download`
: share.url;
const shareId = share.id;
const deleteAction: RemoteDeleteAction | undefined = shareId
? {
method: "DELETE",
url: endpoint(host, "ocs", "v1.php", "apps", "files_sharing", "api", "v1", "shares", shareId),
headers: requestHeaders,
}
: undefined;
return publication("owncloud", request, url, {
...(expiryInfo.expiresAt === undefined ? {} : { expiresAt: expiryInfo.expiresAt }),
...(deleteAction ? { delete: deleteAction } : {}),
...(shareId ? { remoteId: shareId } : {}),View on GitHub (pinned to 9690622007)
Solutions
- Ensure options.path matches exactly where the file was PUT via WebDAV (share path is built as `/${pathParts}/${filename}` — case-sensitive).
- Ask the ownCloud admin to enable the files_sharing app and allow public link shares for your user.
- Check the server response body for the OCS message (e.g. 'Wrong path, file/folder does not exist') and correct directory/filename casing or accents.
- Test the share manually: curl -u user:pass -H 'OCS-APIREQUEST: true' -F path=/file.txt -F shareType=3 .../ocs/v1.php/apps/files_sharing/api/v1/shares?format=json and inspect statuscode.
Example fix
// before options.path = "Reports"; // file uploaded to /remote.php/webdav/Reports/file.txt but share path built as /reports/file.txt elsewhere? ensure both identical // after options.path = "reports"; // matches the directory actually used for the DAV PUT, so share path resolves
Defensive patterns
Strategy: try-catch
Try / catch
try {
await uploader.upload(request);
} catch (err) {
if (err instanceof Error && err.message.includes('unsuccessful OCS status')) {
// inspect the raw share response (path not found vs sharing disabled) before retrying
// 404 => fix options.path to match the uploaded WebDAV path; 403 => enable public sharing server-side
} else throw err;
} Prevention
- Keep options.path byte-identical to the WebDAV PUT path (same casing, accents, leading segment).
- Pre-flight the share API: POST a share for a known file and assert OCS statuscode 100 during setup.
- Verify files_sharing is enabled and public links are allowed for the service account.
- Avoid renaming/restructuring libraries between the upload and share steps.
When it happens
Trigger: POST to /ocs/v1.php/apps/files_sharing/api/v1/shares returning statuscode 403 (sharing disabled for user), 404 (path not found — e.g. the share path `/${parts.join('/')}` doesn't match the file just uploaded due to a path option mismatch), or 407/other OCS codes.
Common situations: options.path mismatch making the share path differ from the uploaded DAV path; sharing API disabled by the admin; public link sharing disallowed by share policy; ownCloud vs Next.js-style Nextcloud quirks in statuscode handling.
Related errors
- owncloud share response did not include an OCS envelope
- owncloud share response did not include OCS metadata and dat
- owncloud share response did not include an OCS status
- owncloud share response did not include a URL
- This share no longer exists (gist deleted?).
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/8828b79df19fc867.
Report an issue: GitHub.